Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSunil Kumar <sunilk@mono-cvs.ximian.com>2003-11-24 06:58:26 +0300
committerSunil Kumar <sunilk@mono-cvs.ximian.com>2003-11-24 06:58:26 +0300
commitb54c016e597cd7410abdd5f529a1e1d1c341d5e2 (patch)
treeee9ad6c6492500c3b8d5fb8d02a3d951f64344e6 /mcs/class/Novell.Directory.Ldap
parente80ff96eb1282e11d48f8e80839539d5017a8cf1 (diff)
Class files implementing LDAP RFC2251 Messages
svn path=/trunk/mcs/; revision=20366
Diffstat (limited to 'mcs/class/Novell.Directory.Ldap')
-rwxr-xr-xmcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcAbandonRequest.cs82
-rwxr-xr-xmcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcAddRequest.cs119
-rwxr-xr-xmcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcAddResponse.cs89
-rwxr-xr-xmcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcAssertionValue.cs54
-rwxr-xr-xmcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcAttributeDescription.cs55
-rwxr-xr-xmcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcAttributeDescriptionList.cs84
-rwxr-xr-xmcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcAttributeList.cs57
-rwxr-xr-xmcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcAttributeTypeAndValues.cs61
-rwxr-xr-xmcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcAttributeValue.cs55
-rwxr-xr-xmcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcAttributeValueAssertion.cs90
-rwxr-xr-xmcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcAuthenticationChoice.cs72
-rwxr-xr-xmcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcBindRequest.cs166
-rwxr-xr-xmcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcBindResponse.cs141
-rwxr-xr-xmcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcCompareRequest.cs106
-rwxr-xr-xmcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcCompareResponse.cs89
-rwxr-xr-xmcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcControl.cs189
-rwxr-xr-xmcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcControls.cs102
-rwxr-xr-xmcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcDelRequest.cs98
-rwxr-xr-xmcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcDelResponse.cs89
-rwxr-xr-xmcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcExtendedRequest.cs120
-rwxr-xr-xmcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcExtendedResponse.cs156
-rwxr-xr-xmcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcFilter.cs1404
-rwxr-xr-xmcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcLdapDN.cs61
-rwxr-xr-xmcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcLdapMessage.cs342
-rwxr-xr-xmcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcLdapOID.cs54
-rwxr-xr-xmcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcLdapResult.cs211
-rwxr-xr-xmcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcLdapString.cs59
-rwxr-xr-xmcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcLdapURL.cs55
-rwxr-xr-xmcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcMatchingRuleAssertion.cs94
-rwxr-xr-xmcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcMatchingRuleId.cs51
-rwxr-xr-xmcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcMessageID.cs95
-rwxr-xr-xmcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcModifyDNRequest.cs108
-rwxr-xr-xmcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcModifyDNResponse.cs87
-rwxr-xr-xmcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcModifyRequest.cs118
-rwxr-xr-xmcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcModifyResponse.cs89
-rwxr-xr-xmcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcReferral.cs68
-rwxr-xr-xmcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcRelativeLdapDN.cs48
-rwxr-xr-xmcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcRequest.cs49
-rwxr-xr-xmcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcResponse.cs59
-rwxr-xr-xmcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcSaslCredentials.cs66
-rwxr-xr-xmcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcSearchRequest.cs139
-rwxr-xr-xmcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcSearchResultDone.cs88
-rwxr-xr-xmcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcSearchResultEntry.cs98
-rwxr-xr-xmcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcSearchResultReference.cs71
-rwxr-xr-xmcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcSubstringFilter.cs64
-rwxr-xr-xmcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcUnbindRequest.cs83
46 files changed, 5735 insertions, 0 deletions
diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcAbandonRequest.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcAbandonRequest.cs
new file mode 100755
index 00000000000..ad5ddb06e24
--- /dev/null
+++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcAbandonRequest.cs
@@ -0,0 +1,82 @@
+/******************************************************************************
+* The MIT License
+* Copyright (c) 2003 Novell Inc. www.novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the Software), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*******************************************************************************/
+//
+// Novell.Directory.Ldap.Rfc2251.RfcAbandonRequest.cs
+//
+// Author:
+// Sunil Kumar (Sunilk@novell.com)
+//
+// (C) 2003 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using Novell.Directory.Ldap.Asn1;
+using Novell.Directory.Ldap;
+using Novell.Directory.Ldap.Utilclass;
+
+namespace Novell.Directory.Ldap.Rfc2251
+{
+
+ /// <summary> Represents the Ldap Abandon Request.
+ ///
+ /// <pre>
+ /// AbandonRequest ::= [APPLICATION 16] MessageID
+ /// </pre>
+ /// </summary>
+ class RfcAbandonRequest:RfcMessageID, RfcRequest
+ {
+
+ //*************************************************************************
+ // Constructor for AbandonRequest
+ //*************************************************************************
+
+ /// <summary> Constructs an RfcAbandonRequest</summary>
+ public RfcAbandonRequest(int msgId):base(msgId)
+ {
+ return ;
+ }
+
+ //*************************************************************************
+ // Accessors
+ //*************************************************************************
+
+ /// <summary> Override getIdentifier to return an application-wide id.
+ /// <pre>
+ /// ID = CLASS: APPLICATION, FORM: CONSTRUCTED, TAG: 16. (0x50)
+ /// </pre>
+ /// </summary>
+ public override Asn1Identifier getIdentifier()
+ {
+ return new Asn1Identifier(Asn1Identifier.APPLICATION, false, LdapMessage.ABANDON_REQUEST);
+ }
+
+ public RfcRequest dupRequest(System.String base_Renamed, System.String filter, bool reference)
+ {
+ throw new LdapException(ExceptionMessages.NO_DUP_REQUEST, new System.Object[]{"Abandon"}, LdapException.Ldap_NOT_SUPPORTED, (System.String) null);
+ }
+ public System.String getRequestDN()
+ {
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcAddRequest.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcAddRequest.cs
new file mode 100755
index 00000000000..d59be903fe1
--- /dev/null
+++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcAddRequest.cs
@@ -0,0 +1,119 @@
+/******************************************************************************
+* The MIT License
+* Copyright (c) 2003 Novell Inc. www.novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the Software), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*******************************************************************************/
+//
+// Novell.Directory.Ldap.Rfc2251.RfcAddRequest.cs
+//
+// Author:
+// Sunil Kumar (Sunilk@novell.com)
+//
+// (C) 2003 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using Novell.Directory.Ldap.Asn1;
+using Novell.Directory.Ldap;
+
+namespace Novell.Directory.Ldap.Rfc2251
+{
+
+ /// <summary> Represents the Ldap Add Request.
+ ///
+ /// <pre>
+ /// AddRequest ::= [APPLICATION 8] SEQUENCE {
+ /// entry LdapDN,
+ /// attributes AttributeList }
+ /// </pre>
+ /// </summary>
+ public class RfcAddRequest:Asn1Sequence, RfcRequest
+ {
+ /// <summary> Gets the attributes of the entry</summary>
+ virtual public RfcAttributeList Attributes
+ {
+ get
+ {
+ return (RfcAttributeList) get_Renamed(1);
+ }
+
+ }
+
+ //*************************************************************************
+ // Constructors for AddRequest
+ //*************************************************************************
+
+ /// <summary> Constructs an RFCAddRequest
+ ///
+ /// </summary>
+ /// <param name="entry">the entry
+ ///
+ /// </param>
+ /// <param name="attributes">the Attributes making up the Entry
+ /// </param>
+ public RfcAddRequest(RfcLdapDN entry, RfcAttributeList attributes):base(2)
+ {
+ add(entry);
+ add(attributes);
+ return ;
+ }
+
+ /// <summary> Constructs a new Add Request using data from an existing request.
+ ///
+ /// </summary>
+ /// <param name="origRequest">the original request data
+ ///
+ /// </param>
+ /// <param name="base">if not null, replaces the dn of the original request
+ /// </param>
+ /* package */
+ internal RfcAddRequest(Asn1Object[] origRequest, System.String base_Renamed):base(origRequest, origRequest.Length)
+ {
+ // Replace the base if specified, otherwise keep original base
+ if ((System.Object) base_Renamed != null)
+ {
+ set_Renamed(0, new RfcLdapDN(base_Renamed));
+ }
+ return ;
+ }
+ //*************************************************************************
+ // Accessors
+ //*************************************************************************
+
+ /// <summary> Override getIdentifier to return an application-wide id.
+ /// <pre>
+ /// ID = CLASS: APPLICATION, FORM: CONSTRUCTED, TAG: 8. (0x68)
+ /// </pre>
+ /// </summary>
+ public override Asn1Identifier getIdentifier()
+ {
+ return new Asn1Identifier(Asn1Identifier.APPLICATION, true, LdapMessage.ADD_REQUEST);
+ }
+
+ public RfcRequest dupRequest(System.String base_Renamed, System.String filter, bool request)
+ {
+ return new RfcAddRequest(toArray(), base_Renamed);
+ }
+ public System.String getRequestDN()
+ {
+ return ((RfcLdapDN) get_Renamed(0)).stringValue();
+ }
+ }
+}
diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcAddResponse.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcAddResponse.cs
new file mode 100755
index 00000000000..dd181aa57f9
--- /dev/null
+++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcAddResponse.cs
@@ -0,0 +1,89 @@
+/******************************************************************************
+* The MIT License
+* Copyright (c) 2003 Novell Inc. www.novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the Software), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*******************************************************************************/
+//
+// Novell.Directory.Ldap.Rfc2251.RfcAddResponse.cs
+//
+// Author:
+// Sunil Kumar (Sunilk@novell.com)
+//
+// (C) 2003 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using Novell.Directory.Ldap;
+using Novell.Directory.Ldap.Asn1;
+
+namespace Novell.Directory.Ldap.Rfc2251
+{
+
+ /// <summary> Represents the Ldap Add Response.
+ ///
+ /// <pre>
+ /// AddResponse ::= [APPLICATION 9] LdapResult
+ /// </pre>
+ /// </summary>
+ public class RfcAddResponse:RfcLdapResult
+ {
+
+ //*************************************************************************
+ // Constructors for AddResponse
+ //*************************************************************************
+
+ /// <summary> The only time a client will create a AddResponse is when it is
+ /// decoding it from an InputStream
+ /// </summary>
+ [CLSCompliantAttribute(false)]
+ public RfcAddResponse(Asn1Decoder dec, System.IO.Stream in_Renamed, int len):base(dec, in_Renamed, len)
+ {
+ }
+
+ /// <summary> Constructs an RfcAddResponse from parameters.
+ ///
+ /// </summary>
+ /// <param name="resultCode">the result code of the operation
+ ///
+ /// </param>
+ /// <param name="matchedDN">the matched DN returned from the server
+ ///
+ /// </param>
+ /// <param name="errorMessage">the diagnostic message returned from the server
+ ///
+ /// </param>
+ /// <param name="referral">the referral(s) returned by the server
+ /// </param>
+ public RfcAddResponse(Asn1Enumerated resultCode, RfcLdapDN matchedDN, RfcLdapString errorMessage, RfcReferral referral):base(resultCode, matchedDN, errorMessage, referral)
+ {
+ return ;
+ }
+
+ //*************************************************************************
+ // Accessors
+ //*************************************************************************
+
+ /// <summary> Override getIdentifier to return an application-wide id.</summary>
+ public override Asn1Identifier getIdentifier()
+ {
+ return new Asn1Identifier(Asn1Identifier.APPLICATION, true, LdapMessage.ADD_RESPONSE);
+ }
+ }
+}
diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcAssertionValue.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcAssertionValue.cs
new file mode 100755
index 00000000000..6fb142c3e12
--- /dev/null
+++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcAssertionValue.cs
@@ -0,0 +1,54 @@
+/******************************************************************************
+* The MIT License
+* Copyright (c) 2003 Novell Inc. www.novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the Software), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*******************************************************************************/
+//
+// Novell.Directory.Ldap.Rfc2251.RfcAssertionValue.cs
+//
+// Author:
+// Sunil Kumar (Sunilk@novell.com)
+//
+// (C) 2003 Novell, Inc (http://www.novell.com)
+//
+
+
+using System;
+using Novell.Directory.Ldap.Asn1;
+
+namespace Novell.Directory.Ldap.Rfc2251
+{
+
+ /// <summary> Represents the Ldap Assertion Value.
+ ///
+ /// <pre>
+ /// AssertionValue ::= OCTET STRING
+ /// </pre>
+ /// </summary>
+ public class RfcAssertionValue:Asn1OctetString
+ {
+
+ /// <summary> </summary>
+ [CLSCompliantAttribute(false)]
+ public RfcAssertionValue(sbyte[] value_Renamed):base(value_Renamed)
+ {
+ }
+ }
+}
diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcAttributeDescription.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcAttributeDescription.cs
new file mode 100755
index 00000000000..974c7874e32
--- /dev/null
+++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcAttributeDescription.cs
@@ -0,0 +1,55 @@
+/******************************************************************************
+* The MIT License
+* Copyright (c) 2003 Novell Inc. www.novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the Software), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*******************************************************************************/
+//
+// Novell.Directory.Ldap.Rfc2251.RfcAttributeDescription.cs
+//
+// Author:
+// Sunil Kumar (Sunilk@novell.com)
+//
+// (C) 2003 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using Novell.Directory.Ldap.Asn1;
+
+namespace Novell.Directory.Ldap.Rfc2251
+{
+
+ /*
+ * Represents the Ldap Attribute Description.
+ */
+ public class RfcAttributeDescription:RfcLdapString
+ {
+
+ /// <summary> </summary>
+ public RfcAttributeDescription(System.String s):base(s)
+ {
+ }
+
+ /// <summary> </summary>
+ [CLSCompliantAttribute(false)]
+ public RfcAttributeDescription(Asn1Decoder dec, System.IO.Stream in_Renamed, int len):base(dec, in_Renamed, len)
+ {
+ }
+ }
+}
diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcAttributeDescriptionList.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcAttributeDescriptionList.cs
new file mode 100755
index 00000000000..31bd72bef1d
--- /dev/null
+++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcAttributeDescriptionList.cs
@@ -0,0 +1,84 @@
+/******************************************************************************
+* The MIT License
+* Copyright (c) 2003 Novell Inc. www.novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the Software), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*******************************************************************************/
+//
+// Novell.Directory.Ldap.Rfc2251.RfcAttributeDescriptionList.cs
+//
+// Author:
+// Sunil Kumar (Sunilk@novell.com)
+//
+// (C) 2003 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using Novell.Directory.Ldap.Asn1;
+
+namespace Novell.Directory.Ldap.Rfc2251
+{
+
+ /// <summary><pre>
+ /// The AttributeDescriptionList is used to list attributes to be returned in
+ /// a search request.
+ ///
+ /// <pre>
+ /// AttributeDescriptionList ::= SEQUENCE OF
+ /// AttributeDescription
+ /// </pre>
+ ///
+ /// </summary>
+ /// <seealso cref="RfcAttributeDescription">
+ /// </seealso>
+ /// <seealso cref="Asn1SequenceOf">
+ /// </seealso>
+ /// <seealso cref="RfcSearchRequest">
+ /// </seealso>
+ public class RfcAttributeDescriptionList:Asn1SequenceOf
+ {
+ /// <summary> </summary>
+ public RfcAttributeDescriptionList(int size):base(size)
+ {
+ return ;
+ }
+
+ /// <summary> Convenience constructor. This constructor will construct an
+ /// AttributeDescriptionList using the supplied array of Strings.
+ /// </summary>
+ public RfcAttributeDescriptionList(System.String[] attrs):base(attrs == null?0:attrs.Length)
+ {
+
+ if (attrs != null)
+ {
+ for (int i = 0; i < attrs.Length; i++)
+ {
+ add(new RfcAttributeDescription(attrs[i]));
+ }
+ }
+ return ;
+ }
+
+ /*
+ * Override add() to only accept types of AttributeDescription
+ *
+ * @exception Asn1InvalidTypeException
+ */
+ }
+}
diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcAttributeList.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcAttributeList.cs
new file mode 100755
index 00000000000..218974d7345
--- /dev/null
+++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcAttributeList.cs
@@ -0,0 +1,57 @@
+/******************************************************************************
+* The MIT License
+* Copyright (c) 2003 Novell Inc. www.novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the Software), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*******************************************************************************/
+//
+// Novell.Directory.Ldap.Rfc2251.RfcAttributeList.cs
+//
+// Author:
+// Sunil Kumar (Sunilk@novell.com)
+//
+// (C) 2003 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using Novell.Directory.Ldap.Asn1;
+
+namespace Novell.Directory.Ldap.Rfc2251
+{
+
+ /// <summary> Represents an Ldap Attribute List.
+ ///
+ /// <pre>
+ /// AttributeList ::= SEQUENCE OF SEQUENCE {
+ /// type AttributeDescription,
+ /// vals SET OF AttributeValue }
+ /// </pre>
+ /// </summary>
+ public class RfcAttributeList:Asn1SequenceOf
+ {
+
+ //*************************************************************************
+ // Constructor for AttributeList
+ //*************************************************************************
+ public RfcAttributeList(int size):base(size)
+ {
+ return ;
+ }
+ }
+}
diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcAttributeTypeAndValues.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcAttributeTypeAndValues.cs
new file mode 100755
index 00000000000..ee2a94223d7
--- /dev/null
+++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcAttributeTypeAndValues.cs
@@ -0,0 +1,61 @@
+/******************************************************************************
+* The MIT License
+* Copyright (c) 2003 Novell Inc. www.novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the Software), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*******************************************************************************/
+//
+// Novell.Directory.Ldap.Rfc2251.RfcAttributeTypeAndValues.cs
+//
+// Author:
+// Sunil Kumar (Sunilk@novell.com)
+//
+// (C) 2003 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using Novell.Directory.Ldap.Asn1;
+
+namespace Novell.Directory.Ldap.Rfc2251
+{
+
+ /// <summary> Represents and Ldap Attribute Type and Values.
+ ///
+ /// <pre>
+ /// AttributeTypeAndValues ::= SEQUENCE {
+ /// type AttributeDescription,
+ /// vals SET OF AttributeValue }
+ /// </pre>
+ /// </summary>
+ public class RfcAttributeTypeAndValues:Asn1Sequence
+ {
+
+ //*************************************************************************
+ // Constructor for AttributeTypeAndValues
+ //*************************************************************************
+
+ /// <summary> </summary>
+ public RfcAttributeTypeAndValues(RfcAttributeDescription type, Asn1SetOf vals):base(2)
+ {
+ add(type);
+ add(vals);
+ return ;
+ }
+ }
+}
diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcAttributeValue.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcAttributeValue.cs
new file mode 100755
index 00000000000..d3a4101e562
--- /dev/null
+++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcAttributeValue.cs
@@ -0,0 +1,55 @@
+/******************************************************************************
+* The MIT License
+* Copyright (c) 2003 Novell Inc. www.novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the Software), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*******************************************************************************/
+//
+// Novell.Directory.Ldap.Rfc2251.RfcAttributeValue.cs
+//
+// Author:
+// Sunil Kumar (Sunilk@novell.com)
+//
+// (C) 2003 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using Novell.Directory.Ldap.Asn1;
+
+namespace Novell.Directory.Ldap.Rfc2251
+{
+
+ /*
+ * Represents an Ldap Attribute Value.
+ */
+ public class RfcAttributeValue:Asn1OctetString
+ {
+
+ /// <summary> </summary>
+ public RfcAttributeValue(System.String value_Renamed):base(value_Renamed)
+ {
+ }
+
+ /// <summary> </summary>
+ [CLSCompliantAttribute(false)]
+ public RfcAttributeValue(sbyte[] value_Renamed):base(value_Renamed)
+ {
+ }
+ }
+}
diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcAttributeValueAssertion.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcAttributeValueAssertion.cs
new file mode 100755
index 00000000000..dccffd2fb80
--- /dev/null
+++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcAttributeValueAssertion.cs
@@ -0,0 +1,90 @@
+/******************************************************************************
+* The MIT License
+* Copyright (c) 2003 Novell Inc. www.novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the Software), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*******************************************************************************/
+//
+// Novell.Directory.Ldap.Rfc2251.RfcAttributeValueAssertion.cs
+//
+// Author:
+// Sunil Kumar (Sunilk@novell.com)
+//
+// (C) 2003 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using Novell.Directory.Ldap.Asn1;
+
+namespace Novell.Directory.Ldap.Rfc2251
+{
+
+ /// <summary> Represents an Ldap Attribute Value Assertion.
+ ///
+ /// <pre>
+ /// AttributeValueAssertion ::= SEQUENCE {
+ /// attributeDesc AttributeDescription,
+ /// assertionValue AssertionValue }
+ /// </pre>
+ /// </summary>
+ public class RfcAttributeValueAssertion:Asn1Sequence
+ {
+ /// <summary> Returns the attribute description.
+ ///
+ /// </summary>
+ /// <returns> the attribute description
+ /// </returns>
+ virtual public System.String AttributeDescription
+ {
+ get
+ {
+ return ((RfcAttributeDescription) get_Renamed(0)).stringValue();
+ }
+
+ }
+ /// <summary> Returns the assertion value.
+ ///
+ /// </summary>
+ /// <returns> the assertion value.
+ /// </returns>
+ [CLSCompliantAttribute(false)]
+ virtual public sbyte[] AssertionValue
+ {
+ get
+ {
+ return ((RfcAssertionValue) get_Renamed(1)).byteValue();
+ }
+
+ }
+
+ /// <summary> Creates an Attribute Value Assertion.
+ ///
+ /// </summary>
+ /// <param name="ad">The assertion description
+ ///
+ /// </param>
+ /// <param name="av">The assertion value
+ /// </param>
+ public RfcAttributeValueAssertion(RfcAttributeDescription ad, RfcAssertionValue av):base(2)
+ {
+ add(ad);
+ add(av);
+ }
+ }
+}
diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcAuthenticationChoice.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcAuthenticationChoice.cs
new file mode 100755
index 00000000000..ece178f53e7
--- /dev/null
+++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcAuthenticationChoice.cs
@@ -0,0 +1,72 @@
+/******************************************************************************
+* The MIT License
+* Copyright (c) 2003 Novell Inc. www.novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the Software), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*******************************************************************************/
+//
+// Novell.Directory.Ldap.Rfc2251.RfcAuthenticationChoice.cs
+//
+// Author:
+// Sunil Kumar (Sunilk@novell.com)
+//
+// (C) 2003 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using Novell.Directory.Ldap.Asn1;
+
+namespace Novell.Directory.Ldap.Rfc2251
+{
+
+ /// <summary> Represents an Ldap Authentication Choice.
+ ///
+ /// <pre>
+ /// AuthenticationChoice ::= CHOICE {
+ /// simple [0] OCTET STRING,
+ /// -- 1 and 2 reserved
+ /// sasl [3] SaslCredentials }
+ /// </pre>
+ /// </summary>
+ public class RfcAuthenticationChoice:Asn1Choice
+ {
+
+ //*************************************************************************
+ // Constructors for AuthenticationChoice
+ //*************************************************************************
+
+ /// <summary> </summary>
+ public RfcAuthenticationChoice(Asn1Tagged choice):base(choice)
+ {
+ }
+
+ [CLSCompliantAttribute(false)]
+ public RfcAuthenticationChoice(System.String mechanism, sbyte[] credentials):base(new Asn1Tagged(new Asn1Identifier(Asn1Identifier.CONTEXT, true, 3), new RfcSaslCredentials(new RfcLdapString(mechanism), credentials != null?new Asn1OctetString(credentials):null), false))
+ { // implicit tagging
+ }
+
+ //*************************************************************************
+ // Mutators
+ //*************************************************************************
+
+ //*************************************************************************
+ // Accessors
+ //*************************************************************************
+ }
+}
diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcBindRequest.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcBindRequest.cs
new file mode 100755
index 00000000000..84372c66d10
--- /dev/null
+++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcBindRequest.cs
@@ -0,0 +1,166 @@
+/******************************************************************************
+* The MIT License
+* Copyright (c) 2003 Novell Inc. www.novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the Software), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*******************************************************************************/
+//
+// Novell.Directory.Ldap.Rfc2251.RfcBindRequest.cs
+//
+// Author:
+// Sunil Kumar (Sunilk@novell.com)
+//
+// (C) 2003 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using Novell.Directory.Ldap.Asn1;
+using Novell.Directory.Ldap;
+
+namespace Novell.Directory.Ldap.Rfc2251
+{
+
+ /// <summary> Represents and Ldap Bind Request.
+ /// <pre>
+ /// BindRequest ::= [APPLICATION 0] SEQUENCE {
+ /// version INTEGER (1 .. 127),
+ /// name LdapDN,
+ /// authentication AuthenticationChoice }
+ /// </pre>
+ /// </summary>
+ public class RfcBindRequest:Asn1Sequence, RfcRequest
+ {
+ /// <summary> </summary>
+ /// <summary> Sets the protocol version</summary>
+ virtual public Asn1Integer Version
+ {
+ get
+ {
+ return (Asn1Integer) get_Renamed(0);
+ }
+
+ set
+ {
+ set_Renamed(0, value);
+ return ;
+ }
+
+ }
+ /// <summary> </summary>
+ /// <summary> </summary>
+ virtual public RfcLdapDN Name
+ {
+ get
+ {
+ return (RfcLdapDN) get_Renamed(1);
+ }
+
+ set
+ {
+ set_Renamed(1, value);
+ return ;
+ }
+
+ }
+ /// <summary> </summary>
+ /// <summary> </summary>
+ virtual public RfcAuthenticationChoice AuthenticationChoice
+ {
+ get
+ {
+ return (RfcAuthenticationChoice) get_Renamed(2);
+ }
+
+ set
+ {
+ set_Renamed(2, value);
+ return ;
+ }
+
+ }
+
+ /// <summary> ID is added for Optimization.
+ ///
+ /// <p>ID needs only be one Value for every instance,
+ /// thus we create it only once.<p>
+ /// </summary>
+ new private static readonly Asn1Identifier ID = new Asn1Identifier(Asn1Identifier.APPLICATION, true, LdapMessage.BIND_REQUEST);
+
+
+ //*************************************************************************
+ // Constructors for BindRequest
+ //*************************************************************************
+
+ /// <summary> </summary>
+ public RfcBindRequest(Asn1Integer version, RfcLdapDN name, RfcAuthenticationChoice auth):base(3)
+ {
+ add(version);
+ add(name);
+ add(auth);
+ return ;
+ }
+
+ [CLSCompliantAttribute(false)]
+ public RfcBindRequest(int version, System.String dn, System.String mechanism, sbyte[] credentials):this(new Asn1Integer(version), new RfcLdapDN(dn), new RfcAuthenticationChoice(mechanism, credentials))
+ {
+ }
+
+ /// <summary> Constructs a new Bind Request copying the original data from
+ /// an existing request.
+ /// </summary>
+ /* package */
+ internal RfcBindRequest(Asn1Object[] origRequest, System.String base_Renamed):base(origRequest, origRequest.Length)
+ {
+ // Replace the dn if specified, otherwise keep original base
+ if ((System.Object) base_Renamed != null)
+ {
+ set_Renamed(1, new RfcLdapDN(base_Renamed));
+ }
+ return ;
+ }
+
+ //*************************************************************************
+ // Mutators
+ //*************************************************************************
+
+ //*************************************************************************
+ // Accessors
+ //*************************************************************************
+
+ /// <summary> Override getIdentifier to return an application-wide id.
+ ///
+ /// <pre>
+ /// ID = CLASS: APPLICATION, FORM: CONSTRUCTED, TAG: 0. (0x60)
+ /// </pre>
+ /// </summary>
+ public override Asn1Identifier getIdentifier()
+ {
+ return ID;
+ }
+
+ public RfcRequest dupRequest(System.String base_Renamed, System.String filter, bool request)
+ {
+ return new RfcBindRequest(toArray(), base_Renamed);
+ }
+ public System.String getRequestDN()
+ {
+ return ((RfcLdapDN) get_Renamed(1)).stringValue();
+ }
+ }
+}
diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcBindResponse.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcBindResponse.cs
new file mode 100755
index 00000000000..37c7684ddfb
--- /dev/null
+++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcBindResponse.cs
@@ -0,0 +1,141 @@
+/******************************************************************************
+* The MIT License
+* Copyright (c) 2003 Novell Inc. www.novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the Software), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*******************************************************************************/
+//
+// Novell.Directory.Ldap.Rfc2251.RfcBindResponse.cs
+//
+// Author:
+// Sunil Kumar (Sunilk@novell.com)
+//
+// (C) 2003 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using Novell.Directory.Ldap;
+using Novell.Directory.Ldap.Asn1;
+
+namespace Novell.Directory.Ldap.Rfc2251
+{
+
+ /// <summary> Represents and Ldap Bind Response.
+ ///
+ /// <pre>
+ /// BindResponse ::= [APPLICATION 1] SEQUENCE {
+ ///
+ /// COMPONENTS OF LdapResult,
+ /// serverSaslCreds [7] OCTET STRING OPTIONAL }
+ /// </pre>
+ /// </summary>
+ public class RfcBindResponse:Asn1Sequence, RfcResponse
+ {
+ /// <summary> Returns the OPTIONAL serverSaslCreds of a BindResponse if it exists
+ /// otherwise null.
+ /// </summary>
+ virtual public Asn1OctetString ServerSaslCreds
+ {
+ get
+ {
+ if (size() == 5)
+ return (Asn1OctetString) ((Asn1Tagged) get_Renamed(4)).taggedValue();
+
+ if (size() == 4)
+ {
+ // could be referral or serverSaslCreds
+ Asn1Object obj = get_Renamed(3);
+ if (obj is Asn1Tagged)
+ return (Asn1OctetString) ((Asn1Tagged) obj).taggedValue();
+ }
+
+ return null;
+ }
+
+ }
+
+ //*************************************************************************
+ // Constructors for BindResponse
+ //*************************************************************************
+
+ /// <summary> The only time a client will create a BindResponse is when it is
+ /// decoding it from an InputStream
+ ///
+ /// Note: If serverSaslCreds is included in the BindResponse, it does not
+ /// need to be decoded since it is already an OCTET STRING.
+ /// </summary>
+ [CLSCompliantAttribute(false)]
+ public RfcBindResponse(Asn1Decoder dec, System.IO.Stream in_Renamed, int len):base(dec, in_Renamed, len)
+ {
+
+ // Decode optional referral from Asn1OctetString to Referral.
+ if (size() > 3)
+ {
+ Asn1Tagged obj = (Asn1Tagged) get_Renamed(3);
+ Asn1Identifier id = obj.getIdentifier();
+ if (id.Tag == RfcLdapResult.REFERRAL)
+ {
+ sbyte[] content = ((Asn1OctetString) obj.taggedValue()).byteValue();
+ System.IO.MemoryStream bais = new System.IO.MemoryStream(SupportClass.ToByteArray(content));
+ set_Renamed(3, new RfcReferral(dec, bais, content.Length));
+ }
+ }
+ }
+
+ //*************************************************************************
+ // Accessors
+ //*************************************************************************
+
+ /// <summary> </summary>
+ public Asn1Enumerated getResultCode()
+ {
+ return (Asn1Enumerated) get_Renamed(0);
+ }
+
+ /// <summary> </summary>
+ public RfcLdapDN getMatchedDN()
+ {
+ return new RfcLdapDN(((Asn1OctetString) get_Renamed(1)).byteValue());
+ }
+
+ /// <summary> </summary>
+ public RfcLdapString getErrorMessage()
+ {
+ return new RfcLdapString(((Asn1OctetString) get_Renamed(2)).byteValue());
+ }
+
+ /// <summary> </summary>
+ public RfcReferral getReferral()
+ {
+ if (size() > 3)
+ {
+ Asn1Object obj = get_Renamed(3);
+ if (obj is RfcReferral)
+ return (RfcReferral) obj;
+ }
+ return null;
+ }
+
+ /// <summary> Override getIdentifier to return an application-wide id.</summary>
+ public override Asn1Identifier getIdentifier()
+ {
+ return new Asn1Identifier(Asn1Identifier.APPLICATION, true, LdapMessage.BIND_RESPONSE);
+ }
+ }
+}
diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcCompareRequest.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcCompareRequest.cs
new file mode 100755
index 00000000000..ae66a37697f
--- /dev/null
+++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcCompareRequest.cs
@@ -0,0 +1,106 @@
+/******************************************************************************
+* The MIT License
+* Copyright (c) 2003 Novell Inc. www.novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the Software), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*******************************************************************************/
+//
+// Novell.Directory.Ldap.Rfc2251.RfcCompareRequest.cs
+//
+// Author:
+// Sunil Kumar (Sunilk@novell.com)
+//
+// (C) 2003 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using Novell.Directory.Ldap.Asn1;
+using Novell.Directory.Ldap;
+
+namespace Novell.Directory.Ldap.Rfc2251
+{
+
+ /// <summary> Represents and Ldap Compare Request.
+ ///
+ /// <pre>
+ /// CompareRequest ::= [APPLICATION 14] SEQUENCE {
+ /// entry LdapDN,
+ /// ava AttributeValueAssertion }
+ /// </pre>
+ /// </summary>
+ public class RfcCompareRequest:Asn1Sequence, RfcRequest
+ {
+ virtual public RfcAttributeValueAssertion AttributeValueAssertion
+ {
+ get
+ {
+ return ((RfcAttributeValueAssertion) get_Renamed(1));
+ }
+
+ }
+
+ //*************************************************************************
+ // Constructor for CompareRequest
+ //*************************************************************************
+
+ /// <summary> </summary>
+ public RfcCompareRequest(RfcLdapDN entry, RfcAttributeValueAssertion ava):base(2)
+ {
+ add(entry);
+ add(ava);
+ if (ava.AssertionValue == null)
+ {
+ throw new System.ArgumentException("compare: Attribute must have an assertion value");
+ }
+ return ;
+ }
+
+ /// <summary> Constructs a new Compare Request copying from the data of
+ /// an existing request.
+ /// </summary>
+ /* package */
+ internal RfcCompareRequest(Asn1Object[] origRequest, System.String base_Renamed):base(origRequest, origRequest.Length)
+ {
+ // Replace the base if specified, otherwise keep original base
+ if ((System.Object) base_Renamed != null)
+ {
+ set_Renamed(0, new RfcLdapDN(base_Renamed));
+ }
+ return ;
+ }
+ //*************************************************************************
+ // Accessors
+ //*************************************************************************
+
+ /// <summary> Override getIdentifier to return an application-wide id.</summary>
+ public override Asn1Identifier getIdentifier()
+ {
+ return new Asn1Identifier(Asn1Identifier.APPLICATION, true, LdapMessage.COMPARE_REQUEST);
+ }
+
+ public RfcRequest dupRequest(System.String base_Renamed, System.String filter, bool request)
+ {
+ return new RfcCompareRequest(toArray(), base_Renamed);
+ }
+ public System.String getRequestDN()
+ {
+ return ((RfcLdapDN) get_Renamed(0)).stringValue();
+ }
+ }
+}
diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcCompareResponse.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcCompareResponse.cs
new file mode 100755
index 00000000000..0292a90c6d7
--- /dev/null
+++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcCompareResponse.cs
@@ -0,0 +1,89 @@
+/******************************************************************************
+* The MIT License
+* Copyright (c) 2003 Novell Inc. www.novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the Software), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*******************************************************************************/
+//
+// Novell.Directory.Ldap.Rfc2251.RfcCompareResponse.cs
+//
+// Author:
+// Sunil Kumar (Sunilk@novell.com)
+//
+// (C) 2003 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using Novell.Directory.Ldap;
+using Novell.Directory.Ldap.Asn1;
+
+namespace Novell.Directory.Ldap.Rfc2251
+{
+
+ /// <summary> Represents and Ldap Compare Response.
+ ///
+ /// <pre>
+ /// CompareResponse ::= [APPLICATION 15] LdapResult
+ /// </pre>
+ /// </summary>
+ public class RfcCompareResponse:RfcLdapResult
+ {
+
+ //*************************************************************************
+ // Constructor for CompareResponse
+ //*************************************************************************
+
+ /// <summary> The only time a client will create a CompareResponse is when it is
+ /// decoding it from an InputStream
+ /// </summary>
+ [CLSCompliantAttribute(false)]
+ public RfcCompareResponse(Asn1Decoder dec, System.IO.Stream in_Renamed, int len):base(dec, in_Renamed, len)
+ {
+ }
+
+ /// <summary> Constructs an RfcCompareResponse from parameters.
+ ///
+ /// </summary>
+ /// <param name="resultCode">the result code of the operation
+ ///
+ /// </param>
+ /// <param name="matchedDN">the matched DN returned from the server
+ ///
+ /// </param>
+ /// <param name="errorMessage">the diagnostic message returned from the server
+ ///
+ /// </param>
+ /// <param name="referral">the referral(s) returned by the server
+ /// </param>
+ public RfcCompareResponse(Asn1Enumerated resultCode, RfcLdapDN matchedDN, RfcLdapString errorMessage, RfcReferral referral):base(resultCode, matchedDN, errorMessage, referral)
+ {
+ return ;
+ }
+
+ //*************************************************************************
+ // Accessors
+ //*************************************************************************
+
+ /// <summary> Override getIdentifier to return an application-wide id.</summary>
+ public override Asn1Identifier getIdentifier()
+ {
+ return new Asn1Identifier(Asn1Identifier.APPLICATION, true, LdapMessage.COMPARE_RESPONSE);
+ }
+ }
+}
diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcControl.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcControl.cs
new file mode 100755
index 00000000000..ba7366dbfba
--- /dev/null
+++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcControl.cs
@@ -0,0 +1,189 @@
+/******************************************************************************
+* The MIT License
+* Copyright (c) 2003 Novell Inc. www.novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the Software), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*******************************************************************************/
+//
+// Novell.Directory.Ldap.Rfc2251.RfcControl.cs
+//
+// Author:
+// Sunil Kumar (Sunilk@novell.com)
+//
+// (C) 2003 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using Novell.Directory.Ldap.Asn1;
+
+
+namespace Novell.Directory.Ldap.Rfc2251
+{
+
+ /// <summary> Represents an Ldap Control.
+ ///
+ /// <pre>
+ /// Control ::= SEQUENCE {
+ /// controlType LdapOID,
+ /// criticality BOOLEAN DEFAULT FALSE,
+ /// controlValue OCTET STRING OPTIONAL }
+ /// </pre>
+ /// </summary>
+ public class RfcControl:Asn1Sequence
+ {
+ /// <summary> </summary>
+ virtual public Asn1OctetString ControlType
+ {
+ get
+ {
+ return (Asn1OctetString) get_Renamed(0);
+ }
+
+ }
+ /// <summary> Returns criticality.
+ ///
+ /// If no value present, return the default value of FALSE.
+ /// </summary>
+ virtual public Asn1Boolean Criticality
+ {
+ get
+ {
+ if (size() > 1)
+ {
+ // MAY be a criticality
+ Asn1Object obj = get_Renamed(1);
+ if (obj is Asn1Boolean)
+ return (Asn1Boolean) obj;
+ }
+
+ return new Asn1Boolean(false);
+ }
+
+ }
+ /// <summary> Since controlValue is an OPTIONAL component, we need to check
+ /// to see if one is available. Remember that if criticality is of default
+ /// value, it will not be present.
+ /// </summary>
+ /// <summary> Called to set/replace the ControlValue. Will normally be called by
+ /// the child classes after the parent has been instantiated.
+ /// </summary>
+ virtual public Asn1OctetString ControlValue
+ {
+ get
+ {
+ if (size() > 2)
+ {
+ // MUST be a control value
+ return (Asn1OctetString) get_Renamed(2);
+ }
+ else if (size() > 1)
+ {
+ // MAY be a control value
+ Asn1Object obj = get_Renamed(1);
+ if (obj is Asn1OctetString)
+ return (Asn1OctetString) obj;
+ }
+ return null;
+ }
+
+ set
+ {
+
+ if (value == null)
+ return ;
+
+ if (size() == 3)
+ {
+ // We already have a control value, replace it
+ set_Renamed(2, value);
+ return ;
+ }
+
+ if (size() == 2)
+ {
+
+ // Get the second element
+ Asn1Object obj = get_Renamed(1);
+
+ // Is this a control value
+ if (obj is Asn1OctetString)
+ {
+
+ // replace this one
+ set_Renamed(1, value);
+ return ;
+ }
+ else
+ {
+ // add a new one at the end
+ add(value);
+ return ;
+ }
+ }
+ }
+
+ }
+
+ //*************************************************************************
+ // Constructors for Control
+ //*************************************************************************
+
+ /// <summary> </summary>
+ public RfcControl(RfcLdapOID controlType):this(controlType, new Asn1Boolean(false), null)
+ {
+ }
+
+ /// <summary> </summary>
+ public RfcControl(RfcLdapOID controlType, Asn1Boolean criticality):this(controlType, criticality, null)
+ {
+ }
+
+ /// <summary>
+ /// Note: criticality is only added if true, as per RFC 2251 sec 5.1 part
+ /// (4): If a value of a type is its default value, it MUST be
+ /// absent.
+ /// </summary>
+ public RfcControl(RfcLdapOID controlType, Asn1Boolean criticality, Asn1OctetString controlValue):base(3)
+ {
+ add(controlType);
+ if (criticality.booleanValue() == true)
+ add(criticality);
+ if (controlValue != null)
+ add(controlValue);
+ }
+
+ /// <summary> Constructs a Control object by decoding it from an InputStream.</summary>
+ [CLSCompliantAttribute(false)]
+ public RfcControl(Asn1Decoder dec, System.IO.Stream in_Renamed, int len):base(dec, in_Renamed, len)
+ {
+ }
+
+ /// <summary> Constructs a Control object by decoding from an Asn1Sequence</summary>
+ public RfcControl(Asn1Sequence seqObj):base(3)
+ {
+ int len = seqObj.size();
+ for (int i = 0; i < len; i++)
+ add(seqObj.get_Renamed(i));
+ }
+
+ //*************************************************************************
+ // Accessors
+ //*************************************************************************
+ }
+}
diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcControls.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcControls.cs
new file mode 100755
index 00000000000..38b74059a02
--- /dev/null
+++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcControls.cs
@@ -0,0 +1,102 @@
+/******************************************************************************
+* The MIT License
+* Copyright (c) 2003 Novell Inc. www.novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the Software), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*******************************************************************************/
+//
+// Novell.Directory.Ldap.Rfc2251.RfcControls.cs
+//
+// Author:
+// Sunil Kumar (Sunilk@novell.com)
+//
+// (C) 2003 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using Novell.Directory.Ldap.Asn1;
+using Novell.Directory.Ldap.Rfc2251;
+
+namespace Novell.Directory.Ldap.Rfc2251
+{
+
+ /// <summary> Represents Ldap Contreols.
+ ///
+ /// </pre>
+ /// Controls ::= SEQUENCE OF Control
+ /// <pre>
+ /// </summary>
+ public class RfcControls:Asn1SequenceOf
+ {
+
+ /// <summary> Controls context specific tag</summary>
+ public const int CONTROLS = 0;
+
+ //*************************************************************************
+ // Constructors for Controls
+ //*************************************************************************
+
+ /// <summary> Constructs a Controls object. This constructor is used in combination
+ /// with the add() method to construct a set of Controls to send to the
+ /// server.
+ /// </summary>
+ public RfcControls():base(5)
+ {
+ }
+
+ /// <summary> Constructs a Controls object by decoding it from an InputStream.</summary>
+ [CLSCompliantAttribute(false)]
+ public RfcControls(Asn1Decoder dec, System.IO.Stream in_Renamed, int len):base(dec, in_Renamed, len)
+ {
+
+ // Convert each SEQUENCE element to a Control
+ for (int i = 0; i < size(); i++)
+ {
+ RfcControl tempControl = new RfcControl((Asn1Sequence) get_Renamed(i));
+ set_Renamed(i, tempControl);
+ }
+ }
+
+ //*************************************************************************
+ // Mutators
+ //*************************************************************************
+
+ /// <summary> Override add() of Asn1SequenceOf to only accept a Control type.</summary>
+ public void add(RfcControl control)
+ {
+ base.add(control);
+ }
+
+ /// <summary> Override set() of Asn1SequenceOf to only accept a Control type.</summary>
+ public void set_Renamed(int index, RfcControl control)
+ {
+ base.set_Renamed(index, control);
+ }
+
+ //*************************************************************************
+ // Accessors
+ //*************************************************************************
+
+ /// <summary> Override getIdentifier to return a context specific id.</summary>
+ public override Asn1Identifier getIdentifier()
+ {
+ return new Asn1Identifier(Asn1Identifier.CONTEXT, true, CONTROLS);
+ }
+ }
+}
diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcDelRequest.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcDelRequest.cs
new file mode 100755
index 00000000000..f016eb18a02
--- /dev/null
+++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcDelRequest.cs
@@ -0,0 +1,98 @@
+/******************************************************************************
+* The MIT License
+* Copyright (c) 2003 Novell Inc. www.novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the Software), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*******************************************************************************/
+//
+// Novell.Directory.Ldap.Rfc2251.RfcDelRequest.cs
+//
+// Author:
+// Sunil Kumar (Sunilk@novell.com)
+//
+// (C) 2003 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using Novell.Directory.Ldap.Asn1;
+using Novell.Directory.Ldap;
+
+namespace Novell.Directory.Ldap.Rfc2251
+{
+
+ /// <summary> Represents an Ldap Delete Request.
+ ///
+ /// <pre>
+ /// DelRequest ::= [APPLICATION 10] LdapDN
+ /// </pre>
+ /// </summary>
+ public class RfcDelRequest:RfcLdapDN, RfcRequest
+ {
+
+ //*************************************************************************
+ // Constructor for DelRequest
+ //*************************************************************************
+
+ /// <summary> Constructs an Ldapv3 delete request protocol operation.
+ ///
+ /// </summary>
+ /// <param name="dn">The Distinguished Name of the entry to delete.
+ /// </param>
+ public RfcDelRequest(System.String dn):base(dn)
+ {
+ }
+
+ /// <summary> Constructs an Ldapv3 delete request protocol operation.
+ ///
+ /// </summary>
+ /// <param name="dn">The Distinguished Name of the entry to delete.
+ /// </param>
+ [CLSCompliantAttribute(false)]
+ public RfcDelRequest(sbyte[] dn):base(dn)
+ {
+ }
+
+ /// <summary> Override getIdentifier() to return the appropriate application-wide id
+ /// representing this delete request. The getIdentifier() method is called
+ /// when this object is encoded.
+ ///
+ /// Identifier = CLASS: APPLICATION, FORM: CONSTRUCTED, TAG: 10
+ /// </summary>
+ public override Asn1Identifier getIdentifier()
+ {
+ return new Asn1Identifier(Asn1Identifier.APPLICATION, false, LdapMessage.DEL_REQUEST);
+ }
+
+ public RfcRequest dupRequest(System.String base_Renamed, System.String filter, bool request)
+ {
+ if ((System.Object) base_Renamed == null)
+ {
+ return new RfcDelRequest(byteValue());
+ }
+ else
+ {
+ return new RfcDelRequest(base_Renamed);
+ }
+ }
+ public System.String getRequestDN()
+ {
+ return base.stringValue();
+ }
+ }
+}
diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcDelResponse.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcDelResponse.cs
new file mode 100755
index 00000000000..28225bd7cc0
--- /dev/null
+++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcDelResponse.cs
@@ -0,0 +1,89 @@
+/******************************************************************************
+* The MIT License
+* Copyright (c) 2003 Novell Inc. www.novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the Software), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*******************************************************************************/
+//
+// Novell.Directory.Ldap.Rfc2251.RfcDelResponse.cs
+//
+// Author:
+// Sunil Kumar (Sunilk@novell.com)
+//
+// (C) 2003 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using Novell.Directory.Ldap;
+using Novell.Directory.Ldap.Asn1;
+
+namespace Novell.Directory.Ldap.Rfc2251
+{
+
+ /// <summary> Represents and Ldap Delete Response.
+ ///
+ /// <pre>
+ /// DelResponse ::= [APPLICATION 11] LdapResult
+ /// </pre>
+ /// </summary>
+ public class RfcDelResponse:RfcLdapResult
+ {
+
+ //*************************************************************************
+ // Constructors for DelResponse
+ //*************************************************************************
+
+ /// <summary> The only time a client will create a DelResponse is when it is
+ /// decoding it from an InputStream
+ /// </summary>
+ [CLSCompliantAttribute(false)]
+ public RfcDelResponse(Asn1Decoder dec, System.IO.Stream in_Renamed, int len):base(dec, in_Renamed, len)
+ {
+ }
+
+ /// <summary> Constructs an RfcDelResponse from parameters.
+ ///
+ /// </summary>
+ /// <param name="resultCode">the result code of the operation
+ ///
+ /// </param>
+ /// <param name="matchedDN">the matched DN returned from the server
+ ///
+ /// </param>
+ /// <param name="errorMessage">the diagnostic message returned from the server
+ ///
+ /// </param>
+ /// <param name="referral">the referral(s) returned by the server
+ /// </param>
+ public RfcDelResponse(Asn1Enumerated resultCode, RfcLdapDN matchedDN, RfcLdapString errorMessage, RfcReferral referral):base(resultCode, matchedDN, errorMessage, referral)
+ {
+ return ;
+ }
+
+ //*************************************************************************
+ // Accessors
+ //*************************************************************************
+
+ /// <summary> Override getIdentifier to return an application-wide id.</summary>
+ public override Asn1Identifier getIdentifier()
+ {
+ return new Asn1Identifier(Asn1Identifier.APPLICATION, true, LdapMessage.DEL_RESPONSE);
+ }
+ }
+}
diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcExtendedRequest.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcExtendedRequest.cs
new file mode 100755
index 00000000000..09ce21433ef
--- /dev/null
+++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcExtendedRequest.cs
@@ -0,0 +1,120 @@
+/******************************************************************************
+* The MIT License
+* Copyright (c) 2003 Novell Inc. www.novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the Software), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*******************************************************************************/
+//
+// Novell.Directory.Ldap.Rfc2251.RfcExtendedRequest.cs
+//
+// Author:
+// Sunil Kumar (Sunilk@novell.com)
+//
+// (C) 2003 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using Novell.Directory.Ldap.Asn1;
+using Novell.Directory.Ldap;
+
+namespace Novell.Directory.Ldap.Rfc2251
+{
+
+ /// <summary> Represents an Ldap Extended Request.
+ ///
+ /// <pre>
+ /// ExtendedRequest ::= [APPLICATION 23] SEQUENCE {
+ /// requestName [0] LdapOID,
+ /// requestValue [1] OCTET STRING OPTIONAL }
+ /// </pre>
+ /// </summary>
+ public class RfcExtendedRequest:Asn1Sequence, RfcRequest
+ {
+
+ /// <summary> Context-specific TAG for optional requestName.</summary>
+ public const int REQUEST_NAME = 0;
+ /// <summary> Context-specific TAG for optional requestValue.</summary>
+ public const int REQUEST_VALUE = 1;
+
+ //*************************************************************************
+ // Constructors for ExtendedRequest
+ //*************************************************************************
+
+ /// <summary> Constructs an extended request.
+ ///
+ /// </summary>
+ /// <param name="requestName">The OID for this extended operation.
+ /// </param>
+ public RfcExtendedRequest(RfcLdapOID requestName):this(requestName, null)
+ {
+ return ;
+ }
+
+ /// <summary> Constructs an extended request.
+ ///
+ /// </summary>
+ /// <param name="requestName">The OID for this extended operation.
+ /// </param>
+ /// <param name="requestValue">An optional request value.
+ /// </param>
+ public RfcExtendedRequest(RfcLdapOID requestName, Asn1OctetString requestValue):base(2)
+ {
+ add(new Asn1Tagged(new Asn1Identifier(Asn1Identifier.CONTEXT, false, REQUEST_NAME), requestName, false));
+ if (requestValue != null)
+ add(new Asn1Tagged(new Asn1Identifier(Asn1Identifier.CONTEXT, false, REQUEST_VALUE), requestValue, false));
+ return ;
+ }
+
+
+ /// <summary> Constructs an extended request from an existing request.
+ ///
+ /// </summary>
+ /// <param name="origRequest">Asn1Object of existing request
+ /// </param>
+ /* package */
+ public RfcExtendedRequest(Asn1Object[] origRequest):base(origRequest, origRequest.Length)
+ {
+ return ;
+ }
+ //*************************************************************************
+ // Accessors
+ //*************************************************************************
+
+ /// <summary> Override getIdentifier to return an application-wide id.
+ ///
+ /// <pre>
+ /// ID = CLASS: APPLICATION, FORM: CONSTRUCTED, TAG: 23.
+ /// </pre>
+ /// </summary>
+ public override Asn1Identifier getIdentifier()
+ {
+ return new Asn1Identifier(Asn1Identifier.APPLICATION, true, LdapMessage.EXTENDED_REQUEST);
+ }
+
+ public RfcRequest dupRequest(System.String base_Renamed, System.String filter, bool request)
+ {
+ // Just dup the original request
+ return new RfcExtendedRequest(toArray());
+ }
+ public System.String getRequestDN()
+ {
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcExtendedResponse.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcExtendedResponse.cs
new file mode 100755
index 00000000000..683932dd274
--- /dev/null
+++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcExtendedResponse.cs
@@ -0,0 +1,156 @@
+/******************************************************************************
+* The MIT License
+* Copyright (c) 2003 Novell Inc. www.novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the Software), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*******************************************************************************/
+//
+// Novell.Directory.Ldap.Rfc2251.RfcExtendedResponse.cs
+//
+// Author:
+// Sunil Kumar (Sunilk@novell.com)
+//
+// (C) 2003 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using Novell.Directory.Ldap.Asn1;
+using Novell.Directory.Ldap;
+
+namespace Novell.Directory.Ldap.Rfc2251
+{
+
+ /// <summary> Represents an Ldap Extended Response.
+ ///
+ /// <pre>
+ /// ExtendedResponse ::= [APPLICATION 24] SEQUENCE {
+ /// COMPONENTS OF LdapResult,
+ /// responseName [10] LdapOID OPTIONAL,
+ /// response [11] OCTET STRING OPTIONAL }
+ /// </pre>
+ /// </summary>
+ public class RfcExtendedResponse:Asn1Sequence, RfcResponse
+ {
+ /// <summary> </summary>
+ virtual public RfcLdapOID ResponseName
+ {
+ get
+ {
+ return (responseNameIndex != 0)?(RfcLdapOID) get_Renamed(responseNameIndex):null;
+ }
+
+ }
+ /// <summary> </summary>
+ [CLSCompliantAttribute(false)]
+ virtual public Asn1OctetString Response
+ {
+ get
+ {
+ return (responseIndex != 0)?(Asn1OctetString) get_Renamed(responseIndex):null;
+ }
+
+ }
+
+ /// <summary> Context-specific TAG for optional responseName.</summary>
+ public const int RESPONSE_NAME = 10;
+ /// <summary> Context-specific TAG for optional response.</summary>
+ public const int RESPONSE = 11;
+
+ private int referralIndex;
+ private int responseNameIndex;
+ private int responseIndex;
+
+ //*************************************************************************
+ // Constructors for ExtendedResponse
+ //*************************************************************************
+
+ /// <summary> The only time a client will create a ExtendedResponse is when it is
+ /// decoding it from an InputStream
+ /// </summary>
+ [CLSCompliantAttribute(false)]
+ public RfcExtendedResponse(Asn1Decoder dec, System.IO.Stream in_Renamed, int len):base(dec, in_Renamed, len)
+ {
+
+
+ // decode optional tagged elements
+ if (size() > 3)
+ {
+ for (int i = 3; i < size(); i++)
+ {
+ Asn1Tagged obj = (Asn1Tagged) get_Renamed(i);
+ Asn1Identifier id = obj.getIdentifier();
+ switch (id.Tag)
+ {
+
+ case RfcLdapResult.REFERRAL:
+ sbyte[] content = ((Asn1OctetString) obj.taggedValue()).byteValue();
+ System.IO.MemoryStream bais = new System.IO.MemoryStream(SupportClass.ToByteArray(content));
+ set_Renamed(i, new RfcReferral(dec, bais, content.Length));
+ referralIndex = i;
+ break;
+
+ case RESPONSE_NAME:
+ set_Renamed(i, new RfcLdapOID(((Asn1OctetString) obj.taggedValue()).byteValue()));
+ responseNameIndex = i;
+ break;
+
+ case RESPONSE:
+ set_Renamed(i, obj.taggedValue());
+ responseIndex = i;
+ break;
+ }
+ }
+ }
+ }
+
+ //*************************************************************************
+ // Accessors
+ //*************************************************************************
+
+ /// <summary> </summary>
+ public Asn1Enumerated getResultCode()
+ {
+ return (Asn1Enumerated) get_Renamed(0);
+ }
+
+ /// <summary> </summary>
+ public RfcLdapDN getMatchedDN()
+ {
+ return new RfcLdapDN(((Asn1OctetString) get_Renamed(1)).byteValue());
+ }
+
+ /// <summary> </summary>
+ public RfcLdapString getErrorMessage()
+ {
+ return new RfcLdapString(((Asn1OctetString) get_Renamed(2)).byteValue());
+ }
+
+ /// <summary> </summary>
+ public RfcReferral getReferral()
+ {
+ return (referralIndex != 0)?(RfcReferral) get_Renamed(referralIndex):null;
+ }
+
+ /// <summary> Override getIdentifier to return an application-wide id.</summary>
+ public override Asn1Identifier getIdentifier()
+ {
+ return new Asn1Identifier(Asn1Identifier.APPLICATION, true, LdapMessage.EXTENDED_RESPONSE);
+ }
+ }
+}
diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcFilter.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcFilter.cs
new file mode 100755
index 00000000000..230880fb163
--- /dev/null
+++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcFilter.cs
@@ -0,0 +1,1404 @@
+/******************************************************************************
+* The MIT License
+* Copyright (c) 2003 Novell Inc. www.novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the Software), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*******************************************************************************/
+//
+// Novell.Directory.Ldap.Rfc2251.RfcFilter.cs
+//
+// Author:
+// Sunil Kumar (Sunilk@novell.com)
+//
+// (C) 2003 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using Novell.Directory.Ldap.Asn1;
+using LdapException = Novell.Directory.Ldap.LdapException;
+using LdapLocalException = Novell.Directory.Ldap.LdapLocalException;
+using LdapSearchRequest = Novell.Directory.Ldap.LdapSearchRequest;
+using Novell.Directory.Ldap.Utilclass;
+
+namespace Novell.Directory.Ldap.Rfc2251
+{
+
+ /// <summary> Represents an Ldap Filter.
+ ///
+ /// <p>This filter object can be created from a String or can be built up
+ /// programatically by adding filter components one at a time. Existing filter
+ /// components can be iterated though.</p>
+ ///
+ /// <p>Each filter component has an integer identifier defined in this class.
+ /// The following are basic filter components: {@link #EQUALITY_MATCH},
+ /// {@link #GREATER_OR_EQUAL}, {@link #LESS_OR_EQUAL}, {@link #SUBSTRINGS},
+ /// {@link #PRESENT}, {@link #APPROX_MATCH}, {@link #EXTENSIBLE_MATCH}.</p>
+ ///
+ /// <p>More filters can be nested together into more complex filters with the
+ /// following filter components: {@link #AND}, {@link #OR}, {@link #NOT} </p>
+ ///
+ /// <p>Substrings can have three components:
+ /// <pre>
+ /// Filter ::= CHOICE {
+ /// and [0] SET OF Filter,
+ /// or [1] SET OF Filter,
+ /// not [2] Filter,
+ /// equalityMatch [3] AttributeValueAssertion,
+ /// substrings [4] SubstringFilter,
+ /// greaterOrEqual [5] AttributeValueAssertion,
+ /// lessOrEqual [6] AttributeValueAssertion,
+ /// present [7] AttributeDescription,
+ /// approxMatch [8] AttributeValueAssertion,
+ /// extensibleMatch [9] MatchingRuleAssertion }
+ /// </pre>
+ /// </summary>
+ public class RfcFilter:Asn1Choice
+ {
+ //*************************************************************************
+ // Public variables for Filter
+ //*************************************************************************
+
+ /// <summary> Identifier for AND component.</summary>
+ public const int AND = LdapSearchRequest.AND;
+ /// <summary> Identifier for OR component.</summary>
+ public const int OR = LdapSearchRequest.OR;
+ /// <summary> Identifier for NOT component.</summary>
+ public const int NOT = LdapSearchRequest.NOT;
+ /// <summary> Identifier for EQUALITY_MATCH component.</summary>
+ public const int EQUALITY_MATCH = LdapSearchRequest.EQUALITY_MATCH;
+ /// <summary> Identifier for SUBSTRINGS component.</summary>
+ public const int SUBSTRINGS = LdapSearchRequest.SUBSTRINGS;
+ /// <summary> Identifier for GREATER_OR_EQUAL component.</summary>
+ public const int GREATER_OR_EQUAL = LdapSearchRequest.GREATER_OR_EQUAL;
+ /// <summary> Identifier for LESS_OR_EQUAL component.</summary>
+ public const int LESS_OR_EQUAL = LdapSearchRequest.LESS_OR_EQUAL;
+ /// <summary> Identifier for PRESENT component.</summary>
+ public const int PRESENT = LdapSearchRequest.PRESENT;
+ /// <summary> Identifier for APPROX_MATCH component.</summary>
+ public const int APPROX_MATCH = LdapSearchRequest.APPROX_MATCH;
+ /// <summary> Identifier for EXTENSIBLE_MATCH component.</summary>
+ public const int EXTENSIBLE_MATCH = LdapSearchRequest.EXTENSIBLE_MATCH;
+
+ /// <summary> Identifier for INITIAL component.</summary>
+ public const int INITIAL = LdapSearchRequest.INITIAL;
+ /// <summary> Identifier for ANY component.</summary>
+ public const int ANY = LdapSearchRequest.ANY;
+ /// <summary> Identifier for FINAL component.</summary>
+ public const int FINAL = LdapSearchRequest.FINAL;
+
+ //*************************************************************************
+ // Private variables for Filter
+ //*************************************************************************
+
+ private FilterTokenizer ft;
+ private System.Collections.Stack filterStack;
+ private bool finalFound;
+
+ //*************************************************************************
+ // Constructor for Filter
+ //*************************************************************************
+
+ /// <summary> Constructs a Filter object by parsing an RFC 2254 Search Filter String.</summary>
+ public RfcFilter(System.String filter):base(null)
+ {
+ ChoiceValue = parse(filter);
+ return ;
+ }
+
+ /// <summary> Constructs a Filter object that will be built up piece by piece. </summary>
+ public RfcFilter():base(null)
+ {
+ filterStack = new System.Collections.Stack();
+ //The choice value must be set later: setChoiceValue(rootFilterTag)
+ return ;
+ }
+
+ //*************************************************************************
+ // Helper methods for RFC 2254 Search Filter parsing.
+ //*************************************************************************
+
+ /// <summary> Parses an RFC 2251 filter string into an ASN.1 Ldap Filter object.</summary>
+ private Asn1Tagged parse(System.String filterExpr)
+ {
+
+ if ((System.Object) filterExpr == null || filterExpr.Equals(""))
+ {
+ filterExpr = new System.Text.StringBuilder("(objectclass=*)").ToString();
+ }
+
+ int idx;
+ if ((idx = filterExpr.IndexOf((System.Char) '\\')) != - 1)
+ {
+ System.Text.StringBuilder sb = new System.Text.StringBuilder(filterExpr);
+ int i = idx;
+ while (i < (sb.Length - 1))
+ {
+ char c = sb[i++];
+ if (c == '\\')
+ {
+ // found '\' (backslash)
+ // If V2 escape, turn to a V3 escape
+ c = sb[i];
+ if (c == '*' || c == '(' || c == ')' || c == '\\')
+ {
+ // Ldap v2 filter, convert them into hex chars
+ sb.Remove(i, i + 1 - i);
+ sb.Insert(i, System.Convert.ToString((int) c, 16));
+ i += 2;
+ }
+ }
+ }
+ filterExpr = sb.ToString();
+ }
+
+ // missing opening and closing parentheses, must be V2, add parentheses
+ if ((filterExpr[0] != '(') && (filterExpr[filterExpr.Length - 1] != ')'))
+ {
+ filterExpr = "(" + filterExpr + ")";
+ }
+
+ char ch = filterExpr[0];
+ int len = filterExpr.Length;
+
+ // missing opening parenthesis ?
+ if (ch != '(')
+ {
+ throw new LdapLocalException(ExceptionMessages.MISSING_LEFT_PAREN, LdapException.FILTER_ERROR);
+ }
+
+ // missing closing parenthesis ?
+ if (filterExpr[len - 1] != ')')
+ {
+ throw new LdapLocalException(ExceptionMessages.MISSING_RIGHT_PAREN, LdapException.FILTER_ERROR);
+ }
+
+ // unmatched parentheses ?
+ int parenCount = 0;
+ for (int i = 0; i < len; i++)
+ {
+ if (filterExpr[i] == '(')
+ {
+ parenCount++;
+ }
+
+ if (filterExpr[i] == ')')
+ {
+ parenCount--;
+ }
+ }
+
+ if (parenCount > 0)
+ {
+ throw new LdapLocalException(ExceptionMessages.MISSING_RIGHT_PAREN, LdapException.FILTER_ERROR);
+ }
+
+ if (parenCount < 0)
+ {
+ throw new LdapLocalException(ExceptionMessages.MISSING_LEFT_PAREN, LdapException.FILTER_ERROR);
+ }
+ ft = new FilterTokenizer(this, filterExpr);
+
+ return parseFilter();
+ }
+
+ /// <summary> Parses an RFC 2254 filter</summary>
+ private Asn1Tagged parseFilter()
+ {
+ ft.getLeftParen();
+
+ Asn1Tagged filter = parseFilterComp();
+
+ ft.getRightParen();
+
+ return filter;
+ }
+
+ /// <summary> RFC 2254 filter helper method. Will Parse a filter component.</summary>
+ private Asn1Tagged parseFilterComp()
+ {
+ Asn1Tagged tag = null;
+ int filterComp = ft.OpOrAttr;
+
+ switch (filterComp)
+ {
+
+ case AND:
+ case OR:
+ tag = new Asn1Tagged(new Asn1Identifier(Asn1Identifier.CONTEXT, true, filterComp), parseFilterList(), false);
+ break;
+
+ case NOT:
+ tag = new Asn1Tagged(new Asn1Identifier(Asn1Identifier.CONTEXT, true, filterComp), parseFilter(), true);
+ break;
+
+ default:
+ int filterType = ft.FilterType;
+ System.String value_Renamed = ft.Value;
+
+ switch (filterType)
+ {
+
+ case GREATER_OR_EQUAL:
+ case LESS_OR_EQUAL:
+ case APPROX_MATCH:
+ tag = new Asn1Tagged(new Asn1Identifier(Asn1Identifier.CONTEXT, true, filterType), new RfcAttributeValueAssertion(new RfcAttributeDescription(ft.Attr), new RfcAssertionValue(unescapeString(value_Renamed))), false);
+ break;
+
+ case EQUALITY_MATCH:
+ if (value_Renamed.Equals("*"))
+ {
+ // present
+ tag = new Asn1Tagged(new Asn1Identifier(Asn1Identifier.CONTEXT, false, PRESENT), new RfcAttributeDescription(ft.Attr), false);
+ }
+ else if (value_Renamed.IndexOf((System.Char) '*') != - 1)
+ {
+ // substrings parse:
+ // [initial], *any*, [final] into an Asn1SequenceOf
+// SupportClass.Tokenizer sub = new StringTokenizer(value_Renamed, "*", true);
+ SupportClass.Tokenizer sub = new SupportClass.Tokenizer(value_Renamed, "*");//, true);
+ Asn1SequenceOf seq = new Asn1SequenceOf(5);
+ int tokCnt = sub.Count;
+ int cnt = 0;
+
+ System.String lastTok = new System.Text.StringBuilder("").ToString();
+
+ while (sub.HasMoreTokens())
+ {
+ System.String subTok = sub.NextToken();
+ cnt++;
+ if (subTok.Equals("*"))
+ {
+ // if previous token was '*', and since the current
+ // token is a '*', we need to insert 'any'
+ if (lastTok.Equals(subTok))
+ {
+ // '**'
+ seq.add(new Asn1Tagged(new Asn1Identifier(Asn1Identifier.CONTEXT, false, ANY), new RfcLdapString(unescapeString("")), false));
+ }
+ }
+ else
+ {
+ // value (RfcLdapString)
+ if (cnt == 1)
+ {
+ // initial
+ seq.add(new Asn1Tagged(new Asn1Identifier(Asn1Identifier.CONTEXT, false, INITIAL), new RfcLdapString(unescapeString(subTok)), false));
+ }
+ else if (cnt < tokCnt)
+ {
+ // any
+ seq.add(new Asn1Tagged(new Asn1Identifier(Asn1Identifier.CONTEXT, false, ANY), new RfcLdapString(unescapeString(subTok)), false));
+ }
+ else
+ {
+ // final
+ seq.add(new Asn1Tagged(new Asn1Identifier(Asn1Identifier.CONTEXT, false, FINAL), new RfcLdapString(unescapeString(subTok)), false));
+ }
+ }
+ lastTok = subTok;
+ }
+
+ tag = new Asn1Tagged(new Asn1Identifier(Asn1Identifier.CONTEXT, true, SUBSTRINGS), new RfcSubstringFilter(new RfcAttributeDescription(ft.Attr), seq), false);
+ }
+ else
+ {
+ // simple
+ tag = new Asn1Tagged(new Asn1Identifier(Asn1Identifier.CONTEXT, true, EQUALITY_MATCH), new RfcAttributeValueAssertion(new RfcAttributeDescription(ft.Attr), new RfcAssertionValue(unescapeString(value_Renamed))), false);
+ }
+ break;
+
+ case EXTENSIBLE_MATCH:
+ System.String type = null, matchingRule = null;
+ bool dnAttributes = false;
+// SupportClass.Tokenizer st = new StringTokenizer(ft.Attr, ":", true);
+ SupportClass.Tokenizer st = new SupportClass.Tokenizer(ft.Attr, ":");//, true);
+
+ bool first = true;
+ while (st.HasMoreTokens())
+ {
+ System.String s = st.NextToken().Trim();
+ if (first && !s.Equals(":"))
+ {
+ type = s;
+ }
+ // dn must be lower case to be considered dn of the Entry.
+ else if (s.Equals("dn"))
+ {
+ dnAttributes = true;
+ }
+ else if (!s.Equals(":"))
+ {
+ matchingRule = s;
+ }
+ first = false;
+ }
+
+ tag = new Asn1Tagged(new Asn1Identifier(Asn1Identifier.CONTEXT, true, EXTENSIBLE_MATCH), new RfcMatchingRuleAssertion(((System.Object) matchingRule == null)?null:new RfcMatchingRuleId(matchingRule), ((System.Object) type == null)?null:new RfcAttributeDescription(type), new RfcAssertionValue(unescapeString(value_Renamed)), (dnAttributes == false)?null:new Asn1Boolean(true)), false);
+ break;
+ }
+ break;
+
+ }
+ return tag;
+ }
+
+ /// <summary> Must have 1 or more Filters</summary>
+ private Asn1SetOf parseFilterList()
+ {
+ Asn1SetOf set_Renamed = new Asn1SetOf();
+
+ set_Renamed.add(parseFilter()); // must have at least 1 filter
+
+ while (ft.peekChar() == '(')
+ {
+ // check for more filters
+ set_Renamed.add(parseFilter());
+ }
+ return set_Renamed;
+ }
+
+ /// <summary> Convert hex character to an integer. Return -1 if char is something
+ /// other than a hex char.
+ /// </summary>
+ internal static int hex2int(char c)
+ {
+ return (c >= '0' && c <= '9')?c - '0':(c >= 'A' && c <= 'F')?c - 'A' + 10:(c >= 'a' && c <= 'f')?c - 'a' + 10:- 1;
+ }
+
+ /// <summary> Replace escaped hex digits with the equivalent binary representation.
+ /// Assume either V2 or V3 escape mechanisms:
+ /// V2: \*, \(, \), \\.
+ /// V3: \2A, \28, \29, \5C, \00.
+ ///
+ /// </summary>
+ /// <param name="string"> A part of the input filter string to be converted.
+ ///
+ /// </param>
+ /// <returns> octet-string encoding of the specified string.
+ /// </returns>
+ private sbyte[] unescapeString(System.String string_Renamed)
+ {
+ // give octets enough space to grow
+ sbyte[] octets = new sbyte[string_Renamed.Length * 3];
+ // index for string and octets
+ int iString, iOctets;
+ // escape==true means we are in an escape sequence.
+ bool escape = false;
+ // escStart==true means we are reading the first character of an escape.
+ bool escStart = false;
+
+ int ival, length = string_Renamed.Length;
+ sbyte[] utf8Bytes;
+ char ch; // Character we are adding to the octet string
+ char[] ca = new char[1]; // used while converting multibyte UTF-8 char
+ char temp = (char) (0); // holds the value of the escaped sequence
+
+ // loop through each character of the string and copy them into octets
+ // converting escaped sequences when needed
+ for (iString = 0, iOctets = 0; iString < length; iString++)
+ {
+ ch = string_Renamed[iString];
+ if (escape)
+ {
+ if ((ival = hex2int(ch)) < 0)
+ {
+ // Invalid escape value(not a hex character)
+ throw new LdapLocalException(ExceptionMessages.INVALID_ESCAPE, new System.Object[]{ch}, LdapException.FILTER_ERROR);
+ }
+ else
+ {
+ // V3 escaped: \\**
+ if (escStart)
+ {
+ temp = (char) (ival << 4); // high bits of escaped char
+ escStart = false;
+ }
+ else
+ {
+ temp |= (char) (ival); // all bits of escaped char
+ octets[iOctets++] = (sbyte) temp;
+ escStart = escape = false;
+ }
+ }
+ }
+ else if (ch == '\\')
+ {
+ escStart = escape = true;
+ }
+ else
+ {
+ try
+ {
+ // place the character into octets.
+ if ((ch >= 0x01 && ch <= 0x27) || (ch >= 0x2B && ch <= 0x5B) || (ch >= 0x5D))
+ {
+ // found valid char
+ if (ch <= 0x7f)
+ {
+ // char = %x01-27 / %x2b-5b / %x5d-7f
+ octets[iOctets++] = (sbyte) ch;
+ }
+ else
+ {
+ // char > 0x7f, could be encoded in 2 or 3 bytes
+ ca[0] = ch;
+ System.Text.Encoding encoder = System.Text.Encoding.GetEncoding("utf-8");
+ byte[] ibytes = encoder.GetBytes(new System.String(ca));
+ utf8Bytes=SupportClass.ToSByteArray(ibytes);
+
+// utf8Bytes = new System.String(ca).getBytes("UTF-8");
+ // copy utf8 encoded character into octets
+ Array.Copy((System.Array) SupportClass.ToByteArray(utf8Bytes), 0, (System.Array)SupportClass.ToByteArray( octets), iOctets, utf8Bytes.Length);
+ iOctets = iOctets + utf8Bytes.Length;
+ }
+ escape = false;
+ }
+ else
+ {
+ // found invalid character
+ System.String escString = "";
+ ca[0] = ch;
+ System.Text.Encoding encoder = System.Text.Encoding.GetEncoding("utf-8");
+ byte[] ibytes = encoder.GetBytes(new System.String(ca));
+ utf8Bytes=SupportClass.ToSByteArray(ibytes);
+
+// utf8Bytes = new System.String(ca).getBytes("UTF-8");
+ for (int i = 0; i < utf8Bytes.Length; i++)
+ {
+ sbyte u = utf8Bytes[i];
+ if ((u >= 0) && (u < 0x10))
+ {
+ escString = escString + "\\0" + System.Convert.ToString(u & 0xff, 16);
+ }
+ else
+ {
+ escString = escString + "\\" + System.Convert.ToString(u & 0xff, 16);
+ }
+ }
+ throw new LdapLocalException(ExceptionMessages.INVALID_CHAR_IN_FILTER, new System.Object[]{ch, escString}, LdapException.FILTER_ERROR);
+ }
+ }
+ catch (System.IO.IOException ue)
+ {
+ throw new System.SystemException("UTF-8 String encoding not supported by JVM");
+ }
+ }
+ }
+
+ // Verify that any escape sequence completed
+ if (escStart || escape)
+ {
+ throw new LdapLocalException(ExceptionMessages.SHORT_ESCAPE, LdapException.FILTER_ERROR);
+ }
+
+ sbyte[] toReturn = new sbyte[iOctets];
+// Array.Copy((System.Array)SupportClass.ToByteArray(octets), 0, (System.Array)SupportClass.ToByteArray(toReturn), 0, iOctets);
+ Array.Copy((System.Array)octets, 0, (System.Array)toReturn, 0, iOctets);
+
+ octets = null;
+ return toReturn;
+ }
+
+ /* **********************************************************************
+ * The following methods aid in building filters sequentially,
+ * and is used by DSMLHandler:
+ ***********************************************************************/
+
+ /// <summary> Called by sequential filter building methods to add to a filter
+ /// component.
+ ///
+ /// <p>Verifies that the specified Asn1Object can be added, then adds the
+ /// object to the filter.</p>
+ /// </summary>
+ /// <param name="current"> Filter component to be added to the filter
+ /// @throws LdapLocalException Occurs when an invalid component is added, or
+ /// when the component is out of sequence.
+ /// </param>
+ private void addObject(Asn1Object current)
+ {
+ if (filterStack == null)
+ {
+ filterStack = new System.Collections.Stack();
+ }
+ if (choiceValue() == null)
+ {
+ //ChoiceValue is the root Asn1 node
+ ChoiceValue = current;
+ }
+ else
+ {
+ Asn1Tagged topOfStack = (Asn1Tagged) filterStack.Peek();
+ Asn1Object value_Renamed = topOfStack.taggedValue();
+ if (value_Renamed == null)
+ {
+ topOfStack.TaggedValue = current;
+ filterStack.Push(current);
+// filterStack.Add(current);
+ }
+ else if (value_Renamed is Asn1SetOf)
+ {
+ ((Asn1SetOf) value_Renamed).add(current);
+ //don't add this to the stack:
+ }
+ else if (value_Renamed is Asn1Set)
+ {
+ ((Asn1Set) value_Renamed).add(current);
+ //don't add this to the stack:
+ }
+ else if (value_Renamed.getIdentifier().Tag == LdapSearchRequest.NOT)
+ {
+ throw new LdapLocalException("Attemp to create more than one 'not' sub-filter", LdapException.FILTER_ERROR);
+ }
+ }
+ int type = current.getIdentifier().Tag;
+ if (type == AND || type == OR || type == NOT)
+ {
+// filterStack.Add(current);
+ filterStack.Push(current);
+ }
+ return ;
+ }
+
+ /// <summary> Creates and addes a substrings filter component.
+ ///
+ /// <p>startSubstrings must be immediatly followed by at least one
+ /// {@link #addSubstring} method and one {@link #endSubstrings} method</p>
+ /// @throws com.novell.ldap.LdapLocalException
+ /// Occurs when this component is created out of sequence.
+ /// </summary>
+ public virtual void startSubstrings(System.String attrName)
+ {
+ finalFound = false;
+ Asn1SequenceOf seq = new Asn1SequenceOf(5);
+ Asn1Object current = new Asn1Tagged(new Asn1Identifier(Asn1Identifier.CONTEXT, true, SUBSTRINGS), new RfcSubstringFilter(new RfcAttributeDescription(attrName), seq), false);
+ addObject(current);
+ SupportClass.StackPush(filterStack, seq);
+ return ;
+ }
+
+ /// <summary> Adds a Substring component of initial, any or final substring matching.
+ ///
+ /// <p>This method can be invoked only if startSubString was the last filter-
+ /// building method called. A substring is not required to have an 'INITIAL'
+ /// substring. However, when a filter contains an 'INITIAL' substring only
+ /// one can be added, and it must be the first substring added. Any number of
+ /// 'ANY' substrings can be added. A substring is not required to have a
+ /// 'FINAL' substrings either. However, when a filter does contain a 'FINAL'
+ /// substring only one can be added, and it must be the last substring added.
+ /// </p>
+ /// </summary>
+ /// <param name="type">Substring type: INITIAL | ANY | FINAL]
+ /// </param>
+ /// <param name="value">Value to use for matching
+ /// @throws LdapLocalException Occurs if this method is called out of
+ /// sequence or the type added is out of sequence.
+ /// </param>
+ [CLSCompliantAttribute(false)]
+ public virtual void addSubstring(int type, sbyte[] value_Renamed)
+ {
+ try
+ {
+ Asn1SequenceOf substringSeq = (Asn1SequenceOf) filterStack.Peek();
+ if (type != INITIAL && type != ANY && type != FINAL)
+ {
+ throw new LdapLocalException("Attempt to add an invalid " + "substring type", LdapException.FILTER_ERROR);
+ }
+
+ if (type == INITIAL && substringSeq.size() != 0)
+ {
+ throw new LdapLocalException("Attempt to add an initial " + "substring match after the first substring", LdapException.FILTER_ERROR);
+ }
+ if (finalFound)
+ {
+ throw new LdapLocalException("Attempt to add a substring " + "match after a final substring match", LdapException.FILTER_ERROR);
+ }
+ if (type == FINAL)
+ {
+ finalFound = true;
+ }
+ substringSeq.add(new Asn1Tagged(new Asn1Identifier(Asn1Identifier.CONTEXT, false, type), new RfcLdapString(value_Renamed), false));
+ }
+ catch (System.InvalidCastException e)
+ {
+ throw new LdapLocalException("A call to addSubstring occured " + "without calling startSubstring", LdapException.FILTER_ERROR);
+ }
+ return ;
+ }
+
+ /// <summary> Completes a SubString filter component.
+ ///
+ /// @throws LdapLocalException Occurs when this is called out of sequence,
+ /// or the substrings filter is empty.
+ /// </summary>
+ public virtual void endSubstrings()
+ {
+ try
+ {
+ finalFound = false;
+ Asn1SequenceOf substringSeq = (Asn1SequenceOf) filterStack.Peek();
+ if (substringSeq.size() == 0)
+ {
+ throw new LdapLocalException("Empty substring filter", LdapException.FILTER_ERROR);
+ }
+ }
+ catch (System.InvalidCastException e)
+ {
+ throw new LdapLocalException("Missmatched ending of substrings", LdapException.FILTER_ERROR);
+ }
+ filterStack.Pop();
+ return ;
+ }
+
+ /// <summary> Creates and adds an AttributeValueAssertion to the filter.
+ ///
+ /// </summary>
+ /// <param name="rfcType">Filter type: EQUALITY_MATCH | GREATER_OR_EQUAL
+ /// | LESS_OR_EQUAL | APPROX_MATCH ]
+ /// </param>
+ /// <param name="attrName">Name of the attribute to be asserted
+ /// </param>
+ /// <param name="value">Value of the attribute to be asserted
+ /// @throws LdapLocalException
+ /// Occurs when the filter type is not a valid attribute assertion.
+ /// </param>
+ [CLSCompliantAttribute(false)]
+ public virtual void addAttributeValueAssertion(int rfcType, System.String attrName, sbyte[] value_Renamed)
+ {
+ if (filterStack != null && !(filterStack.Count == 0) && filterStack.Peek() is Asn1SequenceOf)
+ {
+ //If a sequenceof is on the stack then substring is left on the stack
+ throw new LdapLocalException("Cannot insert an attribute assertion in a substring", LdapException.FILTER_ERROR);
+ }
+ if ((rfcType != EQUALITY_MATCH) && (rfcType != GREATER_OR_EQUAL) && (rfcType != LESS_OR_EQUAL) && (rfcType != APPROX_MATCH))
+ {
+ throw new LdapLocalException("Invalid filter type for AttributeValueAssertion", LdapException.FILTER_ERROR);
+ }
+ Asn1Object current = new Asn1Tagged(new Asn1Identifier(Asn1Identifier.CONTEXT, true, rfcType), new RfcAttributeValueAssertion(new RfcAttributeDescription(attrName), new RfcAssertionValue(value_Renamed)), false);
+ addObject(current);
+ return ;
+ }
+
+ /// <summary> Creates and adds a present matching to the filter.
+ ///
+ /// </summary>
+ /// <param name="attrName">Name of the attribute to check for presence.
+ /// @throws LdapLocalException
+ /// Occurs if addPresent is called out of sequence.
+ /// </param>
+ public virtual void addPresent(System.String attrName)
+ {
+ Asn1Object current = new Asn1Tagged(new Asn1Identifier(Asn1Identifier.CONTEXT, false, PRESENT), new RfcAttributeDescription(attrName), false);
+ addObject(current);
+ return ;
+ }
+
+ /// <summary> Adds an extensible match to the filter.
+ ///
+ /// </summary>
+ /// <param name="">matchingRule
+ /// OID or name of the matching rule to use for comparison
+ /// </param>
+ /// <param name="attrName"> Name of the attribute to match.
+ /// </param>
+ /// <param name="value"> Value of the attribute to match against.
+ /// </param>
+ /// <param name="useDNMatching">Indicates whether DN matching should be used.
+ /// @throws LdapLocalException
+ /// Occurs when addExtensibleMatch is called out of sequence.
+ /// </param>
+ [CLSCompliantAttribute(false)]
+ public virtual void addExtensibleMatch(System.String matchingRule, System.String attrName, sbyte[] value_Renamed, bool useDNMatching)
+ {
+ Asn1Object current = new Asn1Tagged(new Asn1Identifier(Asn1Identifier.CONTEXT, true, EXTENSIBLE_MATCH), new RfcMatchingRuleAssertion(((System.Object) matchingRule == null)?null:new RfcMatchingRuleId(matchingRule), ((System.Object) attrName == null)?null:new RfcAttributeDescription(attrName), new RfcAssertionValue(value_Renamed), (useDNMatching == false)?null:new Asn1Boolean(true)), false);
+ addObject(current);
+ return ;
+ }
+
+ /// <summary> Creates and adds the Asn1Tagged value for a nestedFilter: AND, OR, or
+ /// NOT.
+ ///
+ /// <p>Note that a Not nested filter can only have one filter, where AND
+ /// and OR do not</p>
+ ///
+ /// </summary>
+ /// <param name="rfcType">Filter type:
+ /// [AND | OR | NOT]
+ /// @throws com.novell.ldap.LdapLocalException
+ /// </param>
+ public virtual void startNestedFilter(int rfcType)
+ {
+ Asn1Object current;
+ if (rfcType == AND || rfcType == OR)
+ {
+ current = new Asn1Tagged(new Asn1Identifier(Asn1Identifier.CONTEXT, true, rfcType), new Asn1SetOf(), false);
+ }
+ else if (rfcType == NOT)
+ {
+ current = new Asn1Tagged(new Asn1Identifier(Asn1Identifier.CONTEXT, true, rfcType), null, true);
+ }
+ else
+ {
+ throw new LdapLocalException("Attempt to create a nested filter other than AND, OR or NOT", LdapException.FILTER_ERROR);
+ }
+ addObject(current);
+ return ;
+ }
+
+ /// <summary> Completes a nested filter and checks for the valid filter type.</summary>
+ /// <param name="rfcType"> Type of filter to complete.
+ /// @throws com.novell.ldap.LdapLocalException Occurs when the specified
+ /// type differs from the current filter component.
+ /// </param>
+ public virtual void endNestedFilter(int rfcType)
+ {
+ if (rfcType == NOT)
+ {
+ //if this is a Not than Not should be the second thing on the stack
+ filterStack.Pop();
+ }
+ int topOfStackType = ((Asn1Object) filterStack.Peek()).getIdentifier().Tag;
+ if (topOfStackType != rfcType)
+ {
+ throw new LdapLocalException("Missmatched ending of nested filter", LdapException.FILTER_ERROR);
+ }
+ filterStack.Pop();
+ return ;
+ }
+
+ /// <summary> Creates an iterator over the preparsed segments of a filter.
+ ///
+ /// <p>The first object returned by an iterator is an integer indicating the
+ /// type of filter components. Subseqence values are returned. If a
+ /// component is of type 'AND' or 'OR' or 'NOT' then the value
+ /// returned is another iterator. This iterator is used by toString.</p>
+ ///
+ /// </summary>
+ /// <returns> Iterator over filter segments
+ /// </returns>
+ public virtual System.Collections.IEnumerator getFilterIterator()
+ {
+ return new FilterIterator(this, (Asn1Tagged) this.choiceValue());
+ }
+
+ /// <summary> Creates and returns a String representation of this filter.</summary>
+ public virtual System.String filterToString()
+ {
+ System.Text.StringBuilder filter = new System.Text.StringBuilder();
+ stringFilter(this.getFilterIterator(), filter);
+ return filter.ToString();
+ }
+
+ /// <summary> Uses a filterIterator to create a string representation of a filter.
+ ///
+ /// </summary>
+ /// <param name="itr">Iterator of filter components
+ /// </param>
+ /// <param name="filter">Buffer to place a string representation of the filter
+ /// </param>
+ /// <seealso cref="#getFilterIterator">
+ /// </seealso>
+ private static void stringFilter(System.Collections.IEnumerator itr, System.Text.StringBuilder filter)
+ {
+ int op = - 1;
+ filter.Append('(');
+ while (itr.MoveNext())
+ {
+ System.Object filterpart = itr.Current;
+ if (filterpart is System.Int32)
+ {
+ op = ((System.Int32) filterpart);
+ switch (op)
+ {
+
+ case AND:
+ filter.Append('&');
+ break;
+
+ case OR:
+ filter.Append('|');
+ break;
+
+ case NOT:
+ filter.Append('!');
+ break;
+
+ case EQUALITY_MATCH: {
+ filter.Append((System.String) itr.Current);
+ filter.Append('=');
+ sbyte[] value_Renamed = (sbyte[]) itr.Current;
+ filter.Append(byteString(value_Renamed));
+ break;
+ }
+
+ case GREATER_OR_EQUAL: {
+ filter.Append((System.String) itr.Current);
+ filter.Append(">=");
+ sbyte[] value_Renamed = (sbyte[]) itr.Current;
+ filter.Append(byteString(value_Renamed));
+ break;
+ }
+
+ case LESS_OR_EQUAL: {
+ filter.Append((System.String) itr.Current);
+ filter.Append("<=");
+ sbyte[] value_Renamed = (sbyte[]) itr.Current;
+ filter.Append(byteString(value_Renamed));
+ break;
+ }
+
+ case PRESENT:
+ filter.Append((System.String) itr.Current);
+ filter.Append("=*");
+ break;
+
+ case APPROX_MATCH:
+ filter.Append((System.String) itr.Current);
+ filter.Append("~=");
+ sbyte[] value_Renamed2 = (sbyte[]) itr.Current;
+ filter.Append(byteString(value_Renamed2));
+ break;
+
+ case EXTENSIBLE_MATCH:
+ System.String oid = (System.String) itr.Current;
+
+ filter.Append((System.String) itr.Current);
+ filter.Append(':');
+ filter.Append(oid);
+ filter.Append(":=");
+ filter.Append((System.String) itr.Current);
+ break;
+
+ case SUBSTRINGS: {
+ filter.Append((System.String) itr.Current);
+ filter.Append('=');
+ bool noStarLast = false;
+ while (itr.MoveNext())
+ {
+ op = ((System.Int32) itr.Current);
+ switch (op)
+ {
+
+ case INITIAL:
+ filter.Append((System.String) itr.Current);
+ filter.Append('*');
+ noStarLast = false;
+ break;
+
+ case ANY:
+ if (noStarLast)
+ filter.Append('*');
+ filter.Append((System.String) itr.Current);
+ filter.Append('*');
+ noStarLast = false;
+ break;
+
+ case FINAL:
+ if (noStarLast)
+ filter.Append('*');
+ filter.Append((System.String) itr.Current);
+ break;
+ }
+ }
+ break;
+ }
+ }
+ }
+ else if (filterpart is System.Collections.IEnumerator)
+ {
+ stringFilter((System.Collections.IEnumerator) filterpart, filter);
+ }
+ }
+ filter.Append(')');
+ }
+
+ /// <summary> Convert a UTF8 encoded string, or binary data, into a String encoded for
+ /// a string filter.
+ /// </summary>
+ private static System.String byteString(sbyte[] value_Renamed)
+ {
+ System.String toReturn = null;
+ if (Novell.Directory.Ldap.Utilclass.Base64.isValidUTF8(value_Renamed, true))
+ {
+ try
+ {
+ System.Text.Encoding encoder = System.Text.Encoding.GetEncoding("utf-8");
+ char[] dchar = encoder.GetChars(SupportClass.ToByteArray(value_Renamed));
+ toReturn = new String(dchar);
+
+// toReturn = new String(value_Renamed, "UTF-8");
+ }
+ catch (System.IO.IOException e)
+ {
+ throw new System.SystemException("Default JVM does not support UTF-8 encoding" + e);
+ }
+ }
+ else
+ {
+ System.Text.StringBuilder binary = new System.Text.StringBuilder();
+ for (int i = 0; i < value_Renamed.Length; i++)
+ {
+ //TODO repair binary output
+ //Every octet needs to be escaped
+ if (value_Renamed[i] >= 0)
+ {
+ //one character hex string
+ binary.Append("\\0");
+ binary.Append(System.Convert.ToString(value_Renamed[i], 16));
+ }
+ else
+ {
+ //negative (eight character) hex string
+ binary.Append("\\" + System.Convert.ToString(value_Renamed[i], 16).Substring(6));
+ }
+ }
+ toReturn = binary.ToString();
+ }
+ return toReturn;
+ }
+
+ /// <summary> This inner class wrappers the Search Filter with an iterator.
+ /// This iterator will give access to all the individual components
+ /// preparsed. The first call to next will return an Integer identifying
+ /// the type of filter component. Then the component values will be returned
+ /// AND, NOT, and OR components values will be returned as Iterators.
+ /// </summary>
+ private class FilterIterator : System.Collections.IEnumerator
+ {
+ public void Reset(){}
+ private void InitBlock(RfcFilter enclosingInstance)
+ {
+ this.enclosingInstance = enclosingInstance;
+ }
+ private RfcFilter enclosingInstance;
+ /// <summary> Returns filter identifiers and components of a filter.
+ ///
+ /// The first object returned is an Integer identifying
+ /// its type.
+ /// </summary>
+ public virtual System.Object Current
+ {
+ get
+ {
+ System.Object toReturn = null;
+ if (!tagReturned)
+ {
+ tagReturned = true;
+ toReturn = root.getIdentifier().Tag;
+ }
+ else
+ {
+ Asn1Object asn1 = root.taggedValue();
+
+ if (asn1 is RfcLdapString)
+ {
+ //one value to iterate
+ hasMore = false;
+ toReturn = ((RfcLdapString) asn1).stringValue();
+ }
+ else if (asn1 is RfcSubstringFilter)
+ {
+
+ RfcSubstringFilter sub = (RfcSubstringFilter) asn1;
+ if (index == - 1)
+ {
+ //return attribute name
+ index = 0;
+ RfcAttributeDescription attr = (RfcAttributeDescription) sub.get_Renamed(0);
+ toReturn = attr.stringValue();
+ }
+ else if (index % 2 == 0)
+ {
+ //return substring identifier
+ Asn1SequenceOf substrs = (Asn1SequenceOf) sub.get_Renamed(1);
+ toReturn = ((Asn1Tagged) substrs.get_Renamed(index / 2)).getIdentifier().Tag;
+ index++;
+ }
+ else
+ {
+ //return substring value
+ Asn1SequenceOf substrs = (Asn1SequenceOf) sub.get_Renamed(1);
+ Asn1Tagged tag = (Asn1Tagged) substrs.get_Renamed(index / 2);
+ RfcLdapString value_Renamed = (RfcLdapString) tag.taggedValue();
+ toReturn = value_Renamed.stringValue();
+ index++;
+ }
+ if (index / 2 >= ((Asn1SequenceOf) sub.get_Renamed(1)).size())
+ {
+ hasMore = false;
+ }
+ }
+ else if (asn1 is RfcAttributeValueAssertion)
+ {
+ // components: =,>=,<=,~=
+ RfcAttributeValueAssertion assertion = (RfcAttributeValueAssertion) asn1;
+
+ if (index == - 1)
+ {
+ toReturn = assertion.AttributeDescription;
+ index = 1;
+ }
+ else if (index == 1)
+ {
+ toReturn = assertion.AssertionValue;
+ index = 2;
+ hasMore = false;
+ }
+ }
+ else if (asn1 is RfcMatchingRuleAssertion)
+ {
+ //Extensible match
+ RfcMatchingRuleAssertion exMatch = (RfcMatchingRuleAssertion) asn1;
+ if (index == - 1)
+ {
+ index = 0;
+ }
+ toReturn = ((Asn1OctetString) ((Asn1Tagged) exMatch.get_Renamed(index++)).taggedValue()).stringValue();
+ if (index > 2)
+ {
+ hasMore = false;
+ }
+ }
+ else if (asn1 is Asn1SetOf)
+ {
+ //AND and OR nested components
+ Asn1SetOf set_Renamed = (Asn1SetOf) asn1;
+ if (index == - 1)
+ {
+ index = 0;
+ }
+ toReturn = new FilterIterator(enclosingInstance,(Asn1Tagged) set_Renamed.get_Renamed(index++));
+ if (index >= set_Renamed.size())
+ {
+ this.hasMore = false;
+ }
+ }
+ else if (asn1 is Asn1Tagged)
+ {
+ //NOT nested component.
+ toReturn = new FilterIterator(enclosingInstance,(Asn1Tagged) asn1);
+ this.hasMore = false;
+ }
+ }
+ return toReturn;
+ }
+
+ }
+ public RfcFilter Enclosing_Instance
+ {
+ get
+ {
+ return enclosingInstance;
+ }
+
+ }
+ internal Asn1Tagged root;
+ /// <summary>indicates if the identifier for a component has been returned yet </summary>
+ internal bool tagReturned = false;
+ /// <summary>indexes the several parts a component may have </summary>
+ internal int index = - 1;
+ private bool hasMore = true;
+
+ public FilterIterator(RfcFilter enclosingInstance, Asn1Tagged root)
+ {
+ InitBlock(enclosingInstance);
+ this.root = root;
+ }
+ public virtual bool MoveNext()
+ {
+ return hasMore;
+ }
+
+ public void remove()
+ {
+ throw new System.NotSupportedException("Remove is not supported on a filter iterator");
+ }
+ }
+
+ /// <summary> This inner class will tokenize the components of an RFC 2254 search filter.</summary>
+ internal class FilterTokenizer
+ {
+ private void InitBlock(RfcFilter enclosingInstance)
+ {
+ this.enclosingInstance = enclosingInstance;
+ }
+ private RfcFilter enclosingInstance;
+ /// <summary> Reads either an operator, or an attribute, whichever is
+ /// next in the filter string.
+ ///
+ /// <p>Operators are &, |, or !.<p>
+ ///
+ /// <p>If the next component is an attribute, it is read and stored in the
+ /// attr field of this class which may be retrieved with getAttr()
+ /// and a -1 is returned. Otherwise, the int value of the operator read is
+ /// returned.</p>
+ /// </summary>
+ virtual public int OpOrAttr
+ {
+ get
+ {
+ int index;
+
+ if (offset >= filterLength)
+ {
+ //"Unexpected end of filter",
+ throw new LdapLocalException(ExceptionMessages.UNEXPECTED_END, LdapException.FILTER_ERROR);
+ }
+ int ret;
+ int testChar = filter[offset];
+ if (testChar == '&')
+ {
+ offset++;
+ ret = Novell.Directory.Ldap.Rfc2251.RfcFilter.AND;
+ }
+ else if (testChar == '|')
+ {
+ offset++;
+ ret = Novell.Directory.Ldap.Rfc2251.RfcFilter.OR;
+ }
+ else if (testChar == '!')
+ {
+ offset++;
+ ret = Novell.Directory.Ldap.Rfc2251.RfcFilter.NOT;
+ }
+ else
+ {
+ if (filter.Substring(offset).StartsWith(":=") == true)
+ {
+ throw new LdapLocalException(ExceptionMessages.NO_MATCHING_RULE, LdapException.FILTER_ERROR);
+ }
+
+ if (filter.Substring(offset).StartsWith("::=") == true || filter.Substring(offset).StartsWith(":::=") == true)
+ {
+ throw new LdapLocalException(ExceptionMessages.NO_DN_NOR_MATCHING_RULE, LdapException.FILTER_ERROR);
+ }
+
+
+ // get first component of 'item' (attr or :dn or :matchingrule)
+ System.String delims = "=~<>()";
+ System.Text.StringBuilder sb = new System.Text.StringBuilder();
+
+ while (delims.IndexOf((System.Char) filter[offset]) == - 1 && filter.Substring(offset).StartsWith(":=") == false)
+ {
+ sb.Append(filter[offset++]);
+ }
+
+ attr = sb.ToString().Trim();
+
+ // is there an attribute name specified in the filter ?
+ if (attr.Length == 0 || attr[0] == ';')
+ {
+ throw new LdapLocalException(ExceptionMessages.NO_ATTRIBUTE_NAME, LdapException.FILTER_ERROR);
+ }
+
+ for (index = 0; index < attr.Length; index++)
+ {
+ char atIndex = attr[index];
+ if (!(System.Char.IsLetterOrDigit(atIndex) || atIndex == '-' || atIndex == '.' || atIndex == ';' || atIndex == ':'))
+ {
+
+ if (atIndex == '\\')
+ {
+ throw new LdapLocalException(ExceptionMessages.INVALID_ESC_IN_DESCR, LdapException.FILTER_ERROR);
+ }
+ else
+ {
+ throw new LdapLocalException(ExceptionMessages.INVALID_CHAR_IN_DESCR, new System.Object[]{atIndex}, LdapException.FILTER_ERROR);
+ }
+ }
+ }
+
+ // is there an option specified in the filter ?
+ index = attr.IndexOf((System.Char) ';');
+ if (index != - 1 && index == attr.Length - 1)
+ {
+ throw new LdapLocalException(ExceptionMessages.NO_OPTION, LdapException.FILTER_ERROR);
+ }
+ ret = - 1;
+ }
+ return ret;
+ }
+
+ }
+ /// <summary> Reads an RFC 2251 filter type from the filter string and returns its
+ /// int value.
+ /// </summary>
+ virtual public int FilterType
+ {
+ get
+ {
+ if (offset >= filterLength)
+ {
+ //"Unexpected end of filter",
+ throw new LdapLocalException(ExceptionMessages.UNEXPECTED_END, LdapException.FILTER_ERROR);
+ }
+ int ret;
+ if (filter.Substring(offset).StartsWith(">="))
+ {
+ offset += 2;
+ ret = Novell.Directory.Ldap.Rfc2251.RfcFilter.GREATER_OR_EQUAL;
+ }
+ else if (filter.Substring(offset).StartsWith("<="))
+ {
+ offset += 2;
+ ret = Novell.Directory.Ldap.Rfc2251.RfcFilter.LESS_OR_EQUAL;
+ }
+ else if (filter.Substring(offset).StartsWith("~="))
+ {
+ offset += 2;
+ ret = Novell.Directory.Ldap.Rfc2251.RfcFilter.APPROX_MATCH;
+ }
+ else if (filter.Substring(offset).StartsWith(":="))
+ {
+ offset += 2;
+ ret = Novell.Directory.Ldap.Rfc2251.RfcFilter.EXTENSIBLE_MATCH;
+ }
+ else if (filter[offset] == '=')
+ {
+ offset++;
+ ret = Novell.Directory.Ldap.Rfc2251.RfcFilter.EQUALITY_MATCH;
+ }
+ else
+ {
+ //"Invalid comparison operator",
+ throw new LdapLocalException(ExceptionMessages.INVALID_FILTER_COMPARISON, LdapException.FILTER_ERROR);
+ }
+ return ret;
+ }
+
+ }
+ /// <summary> Reads a value from a filter string.</summary>
+ virtual public System.String Value
+ {
+ get
+ {
+ if (offset >= filterLength)
+ {
+ //"Unexpected end of filter",
+ throw new LdapLocalException(ExceptionMessages.UNEXPECTED_END, LdapException.FILTER_ERROR);
+ }
+
+ int idx = filter.IndexOf((System.Char) ')', offset);
+ if (idx == - 1)
+ {
+ idx = filterLength;
+ }
+ System.String ret = filter.Substring(offset, (idx) - (offset));
+ offset = idx;
+
+ return ret;
+ }
+
+ }
+ /// <summary> Returns the current attribute identifier.</summary>
+ virtual public System.String Attr
+ {
+ get
+ {
+ return attr;
+ }
+
+ }
+ public RfcFilter Enclosing_Instance
+ {
+ get
+ {
+ return enclosingInstance;
+ }
+
+ }
+
+ //*************************************************************************
+ // Private variables
+ //*************************************************************************
+
+ private System.String filter; // The filter string to parse
+ private System.String attr; // Name of the attribute just parsed
+ private int offset; // Offset pointer into the filter string
+ private int filterLength; // Length of the filter string to parse
+
+ //*************************************************************************
+ // Constructor
+ //*************************************************************************
+
+ /// <summary> Constructs a FilterTokenizer for a filter.</summary>
+ public FilterTokenizer(RfcFilter enclosingInstance, System.String filter)
+ {
+ InitBlock(enclosingInstance);
+ this.filter = filter;
+ this.offset = 0;
+ this.filterLength = filter.Length;
+ return ;
+ }
+
+ //*************************************************************************
+ // Tokenizer methods
+ //*************************************************************************
+
+ /// <summary> Reads the current char and throws an Exception if it is not a left
+ /// parenthesis.
+ /// </summary>
+ public void getLeftParen()
+ {
+ if (offset >= filterLength)
+ {
+ //"Unexpected end of filter",
+ throw new LdapLocalException(ExceptionMessages.UNEXPECTED_END, LdapException.FILTER_ERROR);
+ }
+ if (filter[offset++] != '(')
+ {
+ //"Missing left paren",
+ throw new LdapLocalException(ExceptionMessages.EXPECTING_LEFT_PAREN, new System.Object[]{filter[offset -= 1]}, LdapException.FILTER_ERROR);
+ }
+ return ;
+ }
+
+ /// <summary> Reads the current char and throws an Exception if it is not a right
+ /// parenthesis.
+ /// </summary>
+ public void getRightParen()
+ {
+ if (offset >= filterLength)
+ {
+ //"Unexpected end of filter",
+ throw new LdapLocalException(ExceptionMessages.UNEXPECTED_END, LdapException.FILTER_ERROR);
+ }
+ if (filter[offset++] != ')')
+ {
+ //"Missing right paren",
+ throw new LdapLocalException(ExceptionMessages.EXPECTING_RIGHT_PAREN, new System.Object[]{filter[offset - 1]}, LdapException.FILTER_ERROR);
+ }
+ return ;
+ }
+
+ /// <summary> Return the current char without advancing the offset pointer. This is
+ /// used by ParseFilterList when determining if there are any more
+ /// Filters in the list.
+ /// </summary>
+ public char peekChar()
+ {
+ if (offset >= filterLength)
+ {
+ //"Unexpected end of filter",
+ throw new LdapLocalException(ExceptionMessages.UNEXPECTED_END, LdapException.FILTER_ERROR);
+ }
+ return filter[offset];
+ }
+ }
+ }
+}
diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcLdapDN.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcLdapDN.cs
new file mode 100755
index 00000000000..76b7b796f41
--- /dev/null
+++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcLdapDN.cs
@@ -0,0 +1,61 @@
+/******************************************************************************
+* The MIT License
+* Copyright (c) 2003 Novell Inc. www.novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the Software), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*******************************************************************************/
+//
+// Novell.Directory.Ldap.Rfc2251.RfcLdapDN.cs
+//
+// Author:
+// Sunil Kumar (Sunilk@novell.com)
+//
+// (C) 2003 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+
+namespace Novell.Directory.Ldap.Rfc2251
+{
+
+ /// <summary> Represents an Ldap DN.
+ ///
+ /// <pre>
+ /// LdapDN ::= LdapString
+ /// </pre>
+ /// </summary>
+ public class RfcLdapDN:RfcLdapString
+ {
+
+ //*************************************************************************
+ // Constructors for RfcLdapDN
+ //*************************************************************************
+
+ /// <summary> </summary>
+ public RfcLdapDN(System.String s):base(s)
+ {
+ }
+
+ /// <summary> </summary>
+ [CLSCompliantAttribute(false)]
+ public RfcLdapDN(sbyte[] s):base(s)
+ {
+ }
+ }
+}
diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcLdapMessage.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcLdapMessage.cs
new file mode 100755
index 00000000000..b9f391242e7
--- /dev/null
+++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcLdapMessage.cs
@@ -0,0 +1,342 @@
+/******************************************************************************
+* The MIT License
+* Copyright (c) 2003 Novell Inc. www.novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the Software), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*******************************************************************************/
+//
+// Novell.Directory.Ldap.Rfc2251.RfcLdapMessage.cs
+//
+// Author:
+// Sunil Kumar (Sunilk@novell.com)
+//
+// (C) 2003 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using LdapException = Novell.Directory.Ldap.LdapException;
+using LdapMessage = Novell.Directory.Ldap.LdapMessage;
+using Novell.Directory.Ldap.Asn1;
+
+namespace Novell.Directory.Ldap.Rfc2251
+{
+
+ /// <summary> Represents an Ldap Message.
+ ///
+ /// <pre>
+ /// LdapMessage ::= SEQUENCE {
+ /// messageID MessageID,
+ /// protocolOp CHOICE {
+ /// bindRequest BindRequest,
+ /// bindResponse BindResponse,
+ /// unbindRequest UnbindRequest,
+ /// searchRequest SearchRequest,
+ /// searchResEntry SearchResultEntry,
+ /// searchResDone SearchResultDone,
+ /// searchResRef SearchResultReference,
+ /// modifyRequest ModifyRequest,
+ /// modifyResponse ModifyResponse,
+ /// addRequest AddRequest,
+ /// addResponse AddResponse,
+ /// delRequest DelRequest,
+ /// delResponse DelResponse,
+ /// modDNRequest ModifyDNRequest,
+ /// modDNResponse ModifyDNResponse,
+ /// compareRequest CompareRequest,
+ /// compareResponse CompareResponse,
+ /// abandonRequest AbandonRequest,
+ /// extendedReq ExtendedRequest,
+ /// extendedResp ExtendedResponse },
+ /// controls [0] Controls OPTIONAL }
+ /// </pre>
+ ///
+ /// <br><br>
+ /// Note: The creation of a MessageID should be hidden within the creation of
+ /// an RfcLdapMessage. The MessageID needs to be in sequence, and has an
+ /// upper and lower limit. There is never a case when a user should be
+ /// able to specify the MessageID for an RfcLdapMessage. The MessageID()
+ /// constructor should be package protected. (So the MessageID value
+ /// isn't arbitrarily run up.)
+ /// </summary>
+ public class RfcLdapMessage:Asn1Sequence
+ {
+ /// <summary> Returns this RfcLdapMessage's messageID as an int.</summary>
+ virtual public int MessageID
+ {
+ get
+ {
+ return ((Asn1Integer) get_Renamed(0)).intValue();
+ }
+
+ }
+ /// <summary> Returns this RfcLdapMessage's message type</summary>
+ virtual public int Type
+ {
+ get
+ {
+ return get_Renamed(1).getIdentifier().Tag;
+ }
+
+ }
+ /// <summary> Returns the response associated with this RfcLdapMessage.
+ /// Can be one of RfcLdapResult, RfcBindResponse, RfcExtendedResponse
+ /// all which extend RfcResponse. It can also be
+ /// RfcSearchResultEntry, or RfcSearchResultReference
+ /// </summary>
+ virtual public Asn1Object Response
+ {
+ get
+ {
+ return get_Renamed(1);
+ }
+
+ }
+ /// <summary> Returns the optional Controls for this RfcLdapMessage.</summary>
+ virtual public RfcControls Controls
+ {
+ get
+ {
+ if (size() > 2)
+ return (RfcControls) get_Renamed(2);
+ return null;
+ }
+
+ }
+ /// <summary> Returns the dn of the request, may be null</summary>
+ virtual public System.String RequestDN
+ {
+ get
+ {
+ return ((RfcRequest) op).getRequestDN();
+ }
+
+ }
+ /// <summary> returns the original request in this message
+ ///
+ /// </summary>
+ /// <returns> the original msg request for this response
+ /// </returns>
+ /// <summary> sets the original request in this message
+ ///
+ /// </summary>
+ /// <param name="msg">the original request for this response
+ /// </param>
+ virtual public LdapMessage RequestingMessage
+ {
+ get
+ {
+ return requestMessage;
+ }
+
+ set
+ {
+ requestMessage = value;
+ return ;
+ }
+
+ }
+
+ private Asn1Object op;
+ private RfcControls controls;
+ private LdapMessage requestMessage = null;
+
+ /// <summary> Create an RfcLdapMessage by copying the content array
+ ///
+ /// </summary>
+ /// <param name="origContent">the array list to copy
+ /// </param>
+ /* package */
+ internal RfcLdapMessage(Asn1Object[] origContent, RfcRequest origRequest, System.String dn, System.String filter, bool reference):base(origContent, origContent.Length)
+ {
+
+ set_Renamed(0, new RfcMessageID()); // MessageID has static counter
+
+ RfcRequest req = (RfcRequest) origContent[1];
+ RfcRequest newreq = req.dupRequest(dn, filter, reference);
+ op = (Asn1Object) newreq;
+ set_Renamed(1, (Asn1Object) newreq);
+
+ return ;
+ }
+
+ /// <summary> Create an RfcLdapMessage using the specified Ldap Request.</summary>
+ public RfcLdapMessage(RfcRequest op):this(op, null)
+ {
+ return ;
+ }
+
+ /// <summary> Create an RfcLdapMessage request from input parameters.</summary>
+ public RfcLdapMessage(RfcRequest op, RfcControls controls):base(3)
+ {
+
+ this.op = (Asn1Object) op;
+ this.controls = controls;
+
+ add(new RfcMessageID()); // MessageID has static counter
+ add((Asn1Object) op);
+ if (controls != null)
+ {
+ add(controls);
+ }
+ return ;
+ }
+
+ /// <summary> Create an RfcLdapMessage using the specified Ldap Response.</summary>
+ public RfcLdapMessage(Asn1Sequence op):this(op, null)
+ {
+ return ;
+ }
+
+ /// <summary> Create an RfcLdapMessage response from input parameters.</summary>
+ public RfcLdapMessage(Asn1Sequence op, RfcControls controls):base(3)
+ {
+
+ this.op = op;
+ this.controls = controls;
+
+ add(new RfcMessageID()); // MessageID has static counter
+ add(op);
+ if (controls != null)
+ {
+ add(controls);
+ }
+ return ;
+ }
+
+ /// <summary> Will decode an RfcLdapMessage directly from an InputStream.</summary>
+ [CLSCompliantAttribute(false)]
+ public RfcLdapMessage(Asn1Decoder dec, System.IO.Stream in_Renamed, int len):base(dec, in_Renamed, len)
+ {
+
+ sbyte[] content;
+ System.IO.MemoryStream bais;
+
+ // Decode implicitly tagged protocol operation from an Asn1Tagged type
+ // to its appropriate application type.
+ Asn1Tagged protocolOp = (Asn1Tagged) get_Renamed(1);
+ Asn1Identifier protocolOpId = protocolOp.getIdentifier();
+ content = ((Asn1OctetString) protocolOp.taggedValue()).byteValue();
+ bais = new System.IO.MemoryStream(SupportClass.ToByteArray(content));
+
+ switch (protocolOpId.Tag)
+ {
+
+ case LdapMessage.SEARCH_RESPONSE:
+ set_Renamed(1, new RfcSearchResultEntry(dec, bais, content.Length));
+ break;
+
+ case LdapMessage.SEARCH_RESULT:
+ set_Renamed(1, new RfcSearchResultDone(dec, bais, content.Length));
+ break;
+
+ case LdapMessage.SEARCH_RESULT_REFERENCE:
+ set_Renamed(1, new RfcSearchResultReference(dec, bais, content.Length));
+ break;
+
+ case LdapMessage.ADD_RESPONSE:
+ set_Renamed(1, new RfcAddResponse(dec, bais, content.Length));
+ break;
+
+ case LdapMessage.BIND_RESPONSE:
+ set_Renamed(1, new RfcBindResponse(dec, bais, content.Length));
+ break;
+
+ case LdapMessage.COMPARE_RESPONSE:
+ set_Renamed(1, new RfcCompareResponse(dec, bais, content.Length));
+ break;
+
+ case LdapMessage.DEL_RESPONSE:
+ set_Renamed(1, new RfcDelResponse(dec, bais, content.Length));
+ break;
+
+ case LdapMessage.EXTENDED_RESPONSE:
+ set_Renamed(1, new RfcExtendedResponse(dec, bais, content.Length));
+ break;
+
+ case LdapMessage.MODIFY_RESPONSE:
+ set_Renamed(1, new RfcModifyResponse(dec, bais, content.Length));
+ break;
+
+ case LdapMessage.MODIFY_RDN_RESPONSE:
+ set_Renamed(1, new RfcModifyDNResponse(dec, bais, content.Length));
+ break;
+
+ default:
+ throw new System.SystemException("RfcLdapMessage: Invalid tag: " + protocolOpId.Tag);
+
+ }
+
+ // decode optional implicitly tagged controls from Asn1Tagged type to
+ // to RFC 2251 types.
+ if (size() > 2)
+ {
+ Asn1Tagged controls = (Asn1Tagged) get_Renamed(2);
+ // Asn1Identifier controlsId = protocolOp.getIdentifier();
+ // we could check to make sure we have controls here....
+
+ content = ((Asn1OctetString) controls.taggedValue()).byteValue();
+ bais = new System.IO.MemoryStream(SupportClass.ToByteArray(content));
+ set_Renamed(2, new RfcControls(dec, bais, content.Length));
+ }
+ return ;
+ }
+
+ //*************************************************************************
+ // Accessors
+ //*************************************************************************
+
+ /// <summary> Returns the request associated with this RfcLdapMessage.
+ /// Throws a class cast exception if the RfcLdapMessage is not a request.
+ /// </summary>
+ public RfcRequest getRequest()
+ {
+ return (RfcRequest) get_Renamed(1);
+ }
+
+ public virtual bool isRequest()
+ {
+ return get_Renamed(1) is RfcRequest;
+ }
+
+ /// <summary> Duplicate this message, replacing base dn, filter, and scope if supplied
+ ///
+ /// </summary>
+ /// <param name="dn">the base dn
+ /// <br><br>
+ /// </param>
+ /// <param name="filter">the filter
+ /// <br><br>
+ /// </param>
+ /// <param name="reference">true if a search reference
+ ///
+ /// </param>
+ /// <returns> the object representing the new message
+ /// </returns>
+ public System.Object dupMessage(System.String dn, System.String filter, bool reference)
+ {
+ if ((op == null))
+ {
+ throw new LdapException("DUP_ERROR", LdapException.LOCAL_ERROR, (System.String) null);
+ }
+
+ RfcLdapMessage newMsg = new RfcLdapMessage(toArray(), (RfcRequest) get_Renamed(1), dn, filter, reference);
+ return newMsg;
+ }
+ }
+}
diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcLdapOID.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcLdapOID.cs
new file mode 100755
index 00000000000..9430894cc4d
--- /dev/null
+++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcLdapOID.cs
@@ -0,0 +1,54 @@
+/******************************************************************************
+* The MIT License
+* Copyright (c) 2003 Novell Inc. www.novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the Software), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*******************************************************************************/
+//
+// Novell.Directory.Ldap.Rfc2251.RfcLdapOID.cs
+//
+// Author:
+// Sunil Kumar (Sunilk@novell.com)
+//
+// (C) 2003 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using Novell.Directory.Ldap.Asn1;
+
+namespace Novell.Directory.Ldap.Rfc2251
+{
+
+ /*
+ * Represents an LdapOID.
+ */
+ public class RfcLdapOID:Asn1OctetString
+ {
+ /// <summary> </summary>
+ public RfcLdapOID(System.String s):base(s)
+ {
+ }
+
+ /// <summary> </summary>
+ [CLSCompliantAttribute(false)]
+ public RfcLdapOID(sbyte[] s):base(s)
+ {
+ }
+ }
+}
diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcLdapResult.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcLdapResult.cs
new file mode 100755
index 00000000000..c842049c0d8
--- /dev/null
+++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcLdapResult.cs
@@ -0,0 +1,211 @@
+/******************************************************************************
+* The MIT License
+* Copyright (c) 2003 Novell Inc. www.novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the Software), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*******************************************************************************/
+//
+// Novell.Directory.Ldap.Rfc2251.RfcLdapResult.cs
+//
+// Author:
+// Sunil Kumar (Sunilk@novell.com)
+//
+// (C) 2003 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using Novell.Directory.Ldap.Asn1;
+
+namespace Novell.Directory.Ldap.Rfc2251
+{
+
+ /// <summary> Represents an LdapResult.
+ ///
+ /// <pre>
+ /// LdapResult ::= SEQUENCE {
+ /// resultCode ENUMERATED {
+ /// success (0),
+ /// operationsError (1),
+ /// protocolError (2),
+ /// timeLimitExceeded (3),
+ /// sizeLimitExceeded (4),
+ /// compareFalse (5),
+ /// compareTrue (6),
+ /// authMethodNotSupported (7),
+ /// strongAuthRequired (8),
+ /// -- 9 reserved --
+ /// referral (10), -- new
+ /// adminLimitExceeded (11), -- new
+ /// unavailableCriticalExtension (12), -- new
+ /// confidentialityRequired (13), -- new
+ /// saslBindInProgress (14), -- new
+ /// noSuchAttribute (16),
+ /// undefinedAttributeType (17),
+ /// inappropriateMatching (18),
+ /// constraintViolation (19),
+ /// attributeOrValueExists (20),
+ /// invalidAttributeSyntax (21),
+ /// -- 22-31 unused --
+ /// noSuchObject (32),
+ /// aliasProblem (33),
+ /// invalidDNSyntax (34),
+ /// -- 35 reserved for undefined isLeaf --
+ /// aliasDereferencingProblem (36),
+ /// -- 37-47 unused --
+ /// inappropriateAuthentication (48),
+ ///
+ /// invalidCredentials (49),
+ /// insufficientAccessRights (50),
+ /// busy (51),
+ /// unavailable (52),
+ /// unwillingToPerform (53),
+ /// loopDetect (54),
+ /// -- 55-63 unused --
+ /// namingViolation (64),
+ /// objectClassViolation (65),
+ /// notAllowedOnNonLeaf (66),
+ /// notAllowedOnRDN (67),
+ /// entryAlreadyExists (68),
+ /// objectClassModsProhibited (69),
+ /// -- 70 reserved for CLdap --
+ /// affectsMultipleDSAs (71), -- new
+ /// -- 72-79 unused --
+ /// other (80) },
+ /// -- 81-90 reserved for APIs --
+ /// matchedDN LdapDN,
+ /// errorMessage LdapString,
+ /// referral [3] Referral OPTIONAL }
+ /// </pre>
+ ///
+ /// </summary>
+ public class RfcLdapResult:Asn1Sequence, RfcResponse
+ {
+
+ /// <summary> Context-specific TAG for optional Referral.</summary>
+ public const int REFERRAL = 3;
+
+ //*************************************************************************
+ // Constructors for RfcLdapResult
+ //*************************************************************************
+
+ /// <summary> Constructs an RfcLdapResult from parameters
+ ///
+ /// </summary>
+ /// <param name="resultCode">the result code of the operation
+ ///
+ /// </param>
+ /// <param name="matchedDN">the matched DN returned from the server
+ ///
+ /// </param>
+ /// <param name="errorMessage">the diagnostic message returned from the server
+ /// </param>
+ public RfcLdapResult(Asn1Enumerated resultCode, RfcLdapDN matchedDN, RfcLdapString errorMessage):this(resultCode, matchedDN, errorMessage, null)
+ {
+ return ;
+ }
+
+ /// <summary> Constructs an RfcLdapResult from parameters
+ ///
+ /// </summary>
+ /// <param name="resultCode">the result code of the operation
+ ///
+ /// </param>
+ /// <param name="matchedDN">the matched DN returned from the server
+ ///
+ /// </param>
+ /// <param name="errorMessage">the diagnostic message returned from the server
+ ///
+ /// </param>
+ /// <param name="referral">the referral(s) returned by the server
+ /// </param>
+ public RfcLdapResult(Asn1Enumerated resultCode, RfcLdapDN matchedDN, RfcLdapString errorMessage, RfcReferral referral):base(4)
+ {
+ add(resultCode);
+ add(matchedDN);
+ add(errorMessage);
+ if (referral != null)
+ add(referral);
+ return ;
+ }
+
+ /// <summary> Constructs an RfcLdapResult from the inputstream</summary>
+ [CLSCompliantAttribute(false)]
+ public RfcLdapResult(Asn1Decoder dec, System.IO.Stream in_Renamed, int len):base(dec, in_Renamed, len)
+ {
+
+ // Decode optional referral from Asn1OctetString to Referral.
+ if (size() > 3)
+ {
+ Asn1Tagged obj = (Asn1Tagged) get_Renamed(3);
+ Asn1Identifier id = obj.getIdentifier();
+ if (id.Tag == RfcLdapResult.REFERRAL)
+ {
+ sbyte[] content = ((Asn1OctetString) obj.taggedValue()).byteValue();
+ System.IO.MemoryStream bais = new System.IO.MemoryStream(SupportClass.ToByteArray(content));
+ set_Renamed(3, new RfcReferral(dec, bais, content.Length));
+ }
+ }
+ return ;
+ }
+
+ //*************************************************************************
+ // Accessors
+ //*************************************************************************
+
+ /// <summary> Returns the result code from the server
+ ///
+ /// </summary>
+ /// <returns> the result code
+ /// </returns>
+ public Asn1Enumerated getResultCode()
+ {
+ return (Asn1Enumerated) get_Renamed(0);
+ }
+
+ /// <summary> Returns the matched DN from the server
+ ///
+ /// </summary>
+ /// <returns> the matched DN
+ /// </returns>
+ public RfcLdapDN getMatchedDN()
+ {
+ return new RfcLdapDN(((Asn1OctetString) get_Renamed(1)).byteValue());
+ }
+
+ /// <summary> Returns the error message from the server
+ ///
+ /// </summary>
+ /// <returns> the server error message
+ /// </returns>
+ public RfcLdapString getErrorMessage()
+ {
+ return new RfcLdapString(((Asn1OctetString) get_Renamed(2)).byteValue());
+ }
+
+ /// <summary> Returns the referral(s) from the server
+ ///
+ /// </summary>
+ /// <returns> the referral(s)
+ /// </returns>
+ public RfcReferral getReferral()
+ {
+ return (size() > 3)?(RfcReferral) get_Renamed(3):null;
+ }
+ }
+}
diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcLdapString.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcLdapString.cs
new file mode 100755
index 00000000000..aecb61fa80c
--- /dev/null
+++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcLdapString.cs
@@ -0,0 +1,59 @@
+/******************************************************************************
+* The MIT License
+* Copyright (c) 2003 Novell Inc. www.novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the Software), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*******************************************************************************/
+//
+// Novell.Directory.Ldap.Rfc2251.RfcLdapString.cs
+//
+// Author:
+// Sunil Kumar (Sunilk@novell.com)
+//
+// (C) 2003 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using Novell.Directory.Ldap.Asn1;
+
+namespace Novell.Directory.Ldap.Rfc2251
+{
+
+ /// <summary> Represnts an Ldap String.</summary>
+ public class RfcLdapString:Asn1OctetString
+ {
+
+ /// <summary> </summary>
+ public RfcLdapString(System.String s):base(s)
+ {
+ }
+
+ /// <summary> </summary>
+ [CLSCompliantAttribute(false)]
+ public RfcLdapString(sbyte[] ba):base(ba)
+ {
+ }
+
+ /// <summary> </summary>
+ [CLSCompliantAttribute(false)]
+ public RfcLdapString(Asn1Decoder dec, System.IO.Stream in_Renamed, int len):base(dec, in_Renamed, len)
+ {
+ }
+ }
+}
diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcLdapURL.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcLdapURL.cs
new file mode 100755
index 00000000000..235a6994553
--- /dev/null
+++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcLdapURL.cs
@@ -0,0 +1,55 @@
+/******************************************************************************
+* The MIT License
+* Copyright (c) 2003 Novell Inc. www.novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the Software), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*******************************************************************************/
+//
+// Novell.Directory.Ldap.Rfc2251.RfcLdapURL.cs
+//
+// Author:
+// Sunil Kumar (Sunilk@novell.com)
+//
+// (C) 2003 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+
+namespace Novell.Directory.Ldap.Rfc2251
+{
+
+ /// <summary> Represents an Ldap URL.
+ ///
+ /// <pre>
+ /// LdapURL ::= LdapString -- limited to characters permitted in URLs
+ /// </pre>
+ /// </summary>
+ public class RfcLdapURL:RfcLdapString
+ {
+
+ //*************************************************************************
+ // Constructor for RfcLdapURL
+ //*************************************************************************
+
+ /// <summary> </summary>
+ public RfcLdapURL(System.String s):base(s)
+ {
+ }
+ }
+}
diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcMatchingRuleAssertion.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcMatchingRuleAssertion.cs
new file mode 100755
index 00000000000..9f4b19525dd
--- /dev/null
+++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcMatchingRuleAssertion.cs
@@ -0,0 +1,94 @@
+/******************************************************************************
+* The MIT License
+* Copyright (c) 2003 Novell Inc. www.novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the Software), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*******************************************************************************/
+//
+// Novell.Directory.Ldap.Rfc2251.RfcMatchingRuleAssertion.cs
+//
+// Author:
+// Sunil Kumar (Sunilk@novell.com)
+//
+// (C) 2003 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using Novell.Directory.Ldap.Asn1;
+
+namespace Novell.Directory.Ldap.Rfc2251
+{
+
+ /// <summary> Represents an Ldap Matching Rule Assertion.
+ ///
+ /// <pre>
+ /// MatchingRuleAssertion ::= SEQUENCE {
+ /// matchingRule [1] MatchingRuleId OPTIONAL,
+ /// type [2] AttributeDescription OPTIONAL,
+ /// matchValue [3] AssertionValue,
+ /// dnAttributes [4] BOOLEAN DEFAULT FALSE }
+ /// </pre>
+ /// </summary>
+ public class RfcMatchingRuleAssertion:Asn1Sequence
+ {
+
+ //*************************************************************************
+ // Constructors for MatchingRuleAssertion
+ //*************************************************************************
+
+ /// <summary> Creates a MatchingRuleAssertion with the only required parameter.
+ ///
+ /// </summary>
+ /// <param name="matchValue">The assertion value.
+ /// </param>
+ public RfcMatchingRuleAssertion(RfcAssertionValue matchValue):this(null, null, matchValue, null)
+ {
+ }
+
+ /// <summary> Creates a MatchingRuleAssertion.
+ ///
+ /// The value null may be passed for an optional value that is not used.
+ ///
+ /// </summary>
+ /// <param name="matchValue">The assertion value.
+ /// </param>
+ /// <param name="matchingRule">Optional matching rule.
+ /// </param>
+ /// <param name="type">Optional attribute description.
+ /// </param>
+ /// <param name="dnAttributes">Asn1Boolean value. (default false)
+ /// </param>
+ public RfcMatchingRuleAssertion(RfcMatchingRuleId matchingRule, RfcAttributeDescription type, RfcAssertionValue matchValue, Asn1Boolean dnAttributes):base(4)
+ {
+ if (matchingRule != null)
+ add(new Asn1Tagged(new Asn1Identifier(Asn1Identifier.CONTEXT, false, 1), matchingRule, false));
+
+ if (type != null)
+ add(new Asn1Tagged(new Asn1Identifier(Asn1Identifier.CONTEXT, false, 2), type, false));
+
+ add(new Asn1Tagged(new Asn1Identifier(Asn1Identifier.CONTEXT, false, 3), matchValue, false));
+
+ // if dnAttributes if false, that is the default value and we must not
+ // encode it. (See RFC 2251 5.1 number 4)
+ if (dnAttributes != null && dnAttributes.booleanValue())
+ add(new Asn1Tagged(new Asn1Identifier(Asn1Identifier.CONTEXT, false, 4), dnAttributes, false));
+ return ;
+ }
+ }
+}
diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcMatchingRuleId.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcMatchingRuleId.cs
new file mode 100755
index 00000000000..575538cb7e6
--- /dev/null
+++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcMatchingRuleId.cs
@@ -0,0 +1,51 @@
+/******************************************************************************
+* The MIT License
+* Copyright (c) 2003 Novell Inc. www.novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the Software), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*******************************************************************************/
+//
+// Novell.Directory.Ldap.Rfc2251.RfcMatchingRuleId.cs
+//
+// Author:
+// Sunil Kumar (Sunilk@novell.com)
+//
+// (C) 2003 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+
+namespace Novell.Directory.Ldap.Rfc2251
+{
+
+ /// <summary> Represents an Ldap Matching Rule ID.
+ ///
+ /// <pre>
+ /// MatchingRuleId ::= LdapString
+ /// </pre>
+ /// </summary>
+ public class RfcMatchingRuleId:RfcLdapString
+ {
+
+ /// <summary> Constructs a MatchingRuleId from a String.</summary>
+ public RfcMatchingRuleId(System.String s):base(s)
+ {
+ }
+ }
+}
diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcMessageID.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcMessageID.cs
new file mode 100755
index 00000000000..d64b9902e24
--- /dev/null
+++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcMessageID.cs
@@ -0,0 +1,95 @@
+/******************************************************************************
+* The MIT License
+* Copyright (c) 2003 Novell Inc. www.novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the Software), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*******************************************************************************/
+//
+// Novell.Directory.Ldap.Rfc2251.RfcMessageID.cs
+//
+// Author:
+// Sunil Kumar (Sunilk@novell.com)
+//
+// (C) 2003 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using Novell.Directory.Ldap.Asn1;
+
+namespace Novell.Directory.Ldap.Rfc2251
+{
+
+ /// <summary> Represents an Ldap Message ID.
+ ///
+ /// <pre>
+ /// MessageID ::= INTEGER (0 .. maxInt)
+ ///
+ /// maxInt INTEGER ::= 2147483647 -- (2^^31 - 1) --
+ ///
+ /// Note: The creation of a MessageID should be hidden within the creation of
+ /// an RfcLdapMessage. The MessageID needs to be in sequence, and has an
+ /// upper and lower limit. There is never a case when a user should be
+ /// able to specify the MessageID for an RfcLdapMessage. The MessageID()
+ /// class should be package protected. (So the MessageID value isn't
+ /// arbitrarily run up.)
+ /// </pre>
+ /// </summary>
+ class RfcMessageID:Asn1Integer
+ {
+ /// <summary> Increments the message number atomically
+ ///
+ /// </summary>
+ /// <returns> the new message number
+ /// </returns>
+ private static int MessageID
+ {
+ get
+ {
+ lock (lock_Renamed)
+ {
+ return (messageID < System.Int32.MaxValue)?++messageID:(messageID = 1);
+ }
+ }
+
+ }
+
+ private static int messageID = 0;
+ private static System.Object lock_Renamed;
+
+ /// <summary> Creates a MessageID with an auto incremented Asn1Integer value.
+ ///
+ /// Bounds: (0 .. 2,147,483,647) (2^^31 - 1 or Integer.MAX_VALUE)
+ ///
+ /// MessageID zero is never used in this implementation. Always
+ /// start the messages with one.
+ /// </summary>
+ protected internal RfcMessageID():base(MessageID)
+ {
+ }
+
+ /// <summary> Creates a MessageID with a specified int value.</summary>
+ protected internal RfcMessageID(int i):base(i)
+ {
+ }
+ static RfcMessageID()
+ {
+ lock_Renamed = new System.Object();
+ }
+ }
+}
diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcModifyDNRequest.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcModifyDNRequest.cs
new file mode 100755
index 00000000000..11646e47670
--- /dev/null
+++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcModifyDNRequest.cs
@@ -0,0 +1,108 @@
+/******************************************************************************
+* The MIT License
+* Copyright (c) 2003 Novell Inc. www.novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the Software), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*******************************************************************************/
+//
+// Novell.Directory.Ldap.Rfc2251.RfcModifyDNRequest.cs
+//
+// Author:
+// Sunil Kumar (Sunilk@novell.com)
+//
+// (C) 2003 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using Novell.Directory.Ldap.Asn1;
+using Novell.Directory.Ldap;
+
+namespace Novell.Directory.Ldap.Rfc2251
+{
+
+ /// <summary> Represents an LDAM MOdify DN Request.
+ ///
+ /// <pre>
+ /// ModifyDNRequest ::= [APPLICATION 12] SEQUENCE {
+ /// entry LdapDN,
+ /// newrdn RelativeLdapDN,
+ /// deleteoldrdn BOOLEAN,
+ /// newSuperior [0] LdapDN OPTIONAL }
+ /// </pre>
+ /// </summary>
+ public class RfcModifyDNRequest:Asn1Sequence, RfcRequest
+ {
+
+ //*************************************************************************
+ // Constructors for ModifyDNRequest
+ //*************************************************************************
+
+ /// <summary> </summary>
+ public RfcModifyDNRequest(RfcLdapDN entry, RfcRelativeLdapDN newrdn, Asn1Boolean deleteoldrdn):this(entry, newrdn, deleteoldrdn, null)
+ {
+ }
+
+ /// <summary> </summary>
+ public RfcModifyDNRequest(RfcLdapDN entry, RfcRelativeLdapDN newrdn, Asn1Boolean deleteoldrdn, RfcLdapDN newSuperior):base(4)
+ {
+ add(entry);
+ add(newrdn);
+ add(deleteoldrdn);
+ if (newSuperior != null)
+ add(newSuperior);
+ }
+
+ /// <summary> Constructs a new Delete Request copying from the ArrayList of
+ /// an existing request.
+ /// </summary>
+ /* package */
+ internal RfcModifyDNRequest(Asn1Object[] origRequest, System.String base_Renamed):base(origRequest, origRequest.Length)
+ {
+ // Replace the base if specified, otherwise keep original base
+ if ((System.Object) base_Renamed != null)
+ {
+ set_Renamed(0, new RfcLdapDN(base_Renamed));
+ }
+ return ;
+ }
+ //*************************************************************************
+ // Accessors
+ //*************************************************************************
+
+ /// <summary> Override getIdentifier to return an application-wide id.
+ ///
+ /// <pre>
+ /// ID = CLASS: APPLICATION, FORM: CONSTRUCTED, TAG: 12.
+ /// </pre>
+ /// </summary>
+ public override Asn1Identifier getIdentifier()
+ {
+ return new Asn1Identifier(Asn1Identifier.APPLICATION, true, LdapMessage.MODIFY_RDN_REQUEST);
+ }
+
+ public RfcRequest dupRequest(System.String base_Renamed, System.String filter, bool request)
+ {
+ return new RfcModifyDNRequest(toArray(), base_Renamed);
+ }
+ public System.String getRequestDN()
+ {
+ return ((RfcLdapDN) get_Renamed(0)).stringValue();
+ }
+ }
+}
diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcModifyDNResponse.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcModifyDNResponse.cs
new file mode 100755
index 00000000000..daccc9a9227
--- /dev/null
+++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcModifyDNResponse.cs
@@ -0,0 +1,87 @@
+/******************************************************************************
+* The MIT License
+* Copyright (c) 2003 Novell Inc. www.novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the Software), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*******************************************************************************/
+//
+// Novell.Directory.Ldap.Rfc2251.RfcModifyDNResponse.cs
+//
+// Author:
+// Sunil Kumar (Sunilk@novell.com)
+//
+// (C) 2003 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using Novell.Directory.Ldap.Asn1;
+using Novell.Directory.Ldap;
+
+namespace Novell.Directory.Ldap.Rfc2251
+{
+
+ /// <summary> Represents an Ldap Modify DN Request.
+ ///
+ /// <pre>
+ /// ModifyDNResponse ::= [APPLICATION 13] LdapResult
+ /// </pre>
+ /// </summary>
+ public class RfcModifyDNResponse:RfcLdapResult
+ {
+
+ //*************************************************************************
+ // Constructor for ModifyDNResponse
+ //*************************************************************************
+
+ /// <summary> Create a ModifyDNResponse by decoding it from an InputStream</summary>
+ [CLSCompliantAttribute(false)]
+ public RfcModifyDNResponse(Asn1Decoder dec, System.IO.Stream in_Renamed, int len):base(dec, in_Renamed, len)
+ {
+ }
+
+ /// <summary> Constructs an RfcModifyDNResponse from parameters.
+ ///
+ /// </summary>
+ /// <param name="resultCode">the result code of the operation
+ ///
+ /// </param>
+ /// <param name="matchedDN">the matched DN returned from the server
+ ///
+ /// </param>
+ /// <param name="errorMessage">the diagnostic message returned from the server
+ ///
+ /// </param>
+ /// <param name="referral">the referral(s) returned by the server
+ /// </param>
+ public RfcModifyDNResponse(Asn1Enumerated resultCode, RfcLdapDN matchedDN, RfcLdapString errorMessage, RfcReferral referral):base(resultCode, matchedDN, errorMessage, referral)
+ {
+ return ;
+ }
+
+ //*************************************************************************
+ // Accessors
+ //*************************************************************************
+
+ /// <summary> Override getIdentifier to return an application-wide id.</summary>
+ public override Asn1Identifier getIdentifier()
+ {
+ return new Asn1Identifier(Asn1Identifier.APPLICATION, true, LdapMessage.MODIFY_RDN_RESPONSE);
+ }
+ }
+}
diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcModifyRequest.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcModifyRequest.cs
new file mode 100755
index 00000000000..85667f0e076
--- /dev/null
+++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcModifyRequest.cs
@@ -0,0 +1,118 @@
+/******************************************************************************
+* The MIT License
+* Copyright (c) 2003 Novell Inc. www.novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the Software), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*******************************************************************************/
+//
+// Novell.Directory.Ldap.Rfc2251.RfcModifyRequest.cs
+//
+// Author:
+// Sunil Kumar (Sunilk@novell.com)
+//
+// (C) 2003 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using Novell.Directory.Ldap.Asn1;
+using Novell.Directory.Ldap;
+
+namespace Novell.Directory.Ldap.Rfc2251
+{
+
+ /// <summary> Represents an Ldap Modify Request.
+ ///
+ /// <pre>
+ /// ModifyRequest ::= [APPLICATION 6] SEQUENCE {
+ /// object LdapDN,
+ /// modification SEQUENCE OF SEQUENCE {
+ /// operation ENUMERATED {
+ /// add (0),
+ /// delete (1),
+ /// replace (2) },
+ /// modification AttributeTypeAndValues } }
+ /// </pre>
+ /// </summary>
+ public class RfcModifyRequest:Asn1Sequence, RfcRequest
+ {
+ /// <summary> Return the Modifications for this request
+ ///
+ /// </summary>
+ /// <returns> the modifications for this request.
+ /// </returns>
+ virtual public Asn1SequenceOf Modifications
+ {
+ get
+ {
+ return (Asn1SequenceOf) get_Renamed(1);
+ }
+
+ }
+
+ //*************************************************************************
+ // Constructor for ModifyRequest
+ //*************************************************************************
+
+ /// <summary> </summary>
+ public RfcModifyRequest(RfcLdapDN object_Renamed, Asn1SequenceOf modification):base(2)
+ {
+ add(object_Renamed);
+ add(modification);
+ return ;
+ }
+
+ /// <summary> Constructs a new Modify Request copying from the ArrayList of
+ /// an existing request.
+ /// </summary>
+ /* package */
+ internal RfcModifyRequest(Asn1Object[] origRequest, System.String base_Renamed):base(origRequest, origRequest.Length)
+ {
+ // Replace the base if specified, otherwise keep original base
+ if ((System.Object) base_Renamed != null)
+ {
+ set_Renamed(0, new RfcLdapDN(base_Renamed));
+ }
+ return ;
+ }
+ //*************************************************************************
+ // Accessors
+ //*************************************************************************
+
+ /// <summary> Override getIdentifier to return an application-wide id.</summary>
+ public override Asn1Identifier getIdentifier()
+ {
+ return new Asn1Identifier(Asn1Identifier.APPLICATION, true, LdapMessage.MODIFY_REQUEST);
+ }
+
+ public RfcRequest dupRequest(System.String base_Renamed, System.String filter, bool request)
+ {
+ return new RfcModifyRequest(toArray(), base_Renamed);
+ }
+
+ /// <summary> Return the String value of the DN associated with this request
+ ///
+ /// </summary>
+ /// <returns> the DN for this request.
+ /// </returns>
+ public System.String getRequestDN()
+ {
+ return ((RfcLdapDN) get_Renamed(0)).stringValue();
+ }
+ }
+}
diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcModifyResponse.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcModifyResponse.cs
new file mode 100755
index 00000000000..3a9516d9709
--- /dev/null
+++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcModifyResponse.cs
@@ -0,0 +1,89 @@
+/******************************************************************************
+* The MIT License
+* Copyright (c) 2003 Novell Inc. www.novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the Software), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*******************************************************************************/
+//
+// Novell.Directory.Ldap.Rfc2251.RfcModifyResponse.cs
+//
+// Author:
+// Sunil Kumar (Sunilk@novell.com)
+//
+// (C) 2003 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using Novell.Directory.Ldap.Asn1;
+using Novell.Directory.Ldap;
+
+namespace Novell.Directory.Ldap.Rfc2251
+{
+
+ /// <summary> Represents an Ldap Modify Response.
+ ///
+ /// <pre>
+ /// ModifyResponse ::= [APPLICATION 7] LdapResult
+ /// </pre>
+ /// </summary>
+ public class RfcModifyResponse:RfcLdapResult
+ {
+
+ //*************************************************************************
+ // Constructor for ModifyResponse
+ //*************************************************************************
+
+ /// <summary> The only time a client will create a ModifyResponse is when it is
+ /// decoding it from an InputStream
+ /// </summary>
+ [CLSCompliantAttribute(false)]
+ public RfcModifyResponse(Asn1Decoder dec, System.IO.Stream in_Renamed, int len):base(dec, in_Renamed, len)
+ {
+ }
+
+ /// <summary> Constructs an RfcModifyResponse from parameters.
+ ///
+ /// </summary>
+ /// <param name="resultCode">the result code of the operation
+ ///
+ /// </param>
+ /// <param name="matchedDN">the matched DN returned from the server
+ ///
+ /// </param>
+ /// <param name="errorMessage">the diagnostic message returned from the server
+ ///
+ /// </param>
+ /// <param name="referral">the referral(s) returned by the server
+ /// </param>
+ public RfcModifyResponse(Asn1Enumerated resultCode, RfcLdapDN matchedDN, RfcLdapString errorMessage, RfcReferral referral):base(resultCode, matchedDN, errorMessage, referral)
+ {
+ return ;
+ }
+
+ //*************************************************************************
+ // Accessors
+ //*************************************************************************
+
+ /// <summary> Override getIdentifier to return an application-wide id.</summary>
+ public override Asn1Identifier getIdentifier()
+ {
+ return new Asn1Identifier(Asn1Identifier.APPLICATION, true, LdapMessage.MODIFY_RESPONSE);
+ }
+ }
+}
diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcReferral.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcReferral.cs
new file mode 100755
index 00000000000..6ac7e56288a
--- /dev/null
+++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcReferral.cs
@@ -0,0 +1,68 @@
+/******************************************************************************
+* The MIT License
+* Copyright (c) 2003 Novell Inc. www.novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the Software), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*******************************************************************************/
+//
+// Novell.Directory.Ldap.Rfc2251.RfcReferral.cs
+//
+// Author:
+// Sunil Kumar (Sunilk@novell.com)
+//
+// (C) 2003 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using Novell.Directory.Ldap.Asn1;
+
+namespace Novell.Directory.Ldap.Rfc2251
+{
+
+ /// <summary> Represents an Ldap Referral.
+ ///
+ /// <pre>
+ /// Referral ::= SEQUENCE OF LdapURL
+ /// </pre>
+ /// </summary>
+ public class RfcReferral:Asn1SequenceOf
+ {
+
+ //*************************************************************************
+ // Constructor for Referral
+ //*************************************************************************
+
+ /// <summary> The only time a Referral object is constructed, is when we are
+ /// decoding an RfcLdapResult or COMPONENTS OF RfcLdapResult.
+ /// </summary>
+ [CLSCompliantAttribute(false)]
+ public RfcReferral(Asn1Decoder dec, System.IO.Stream in_Renamed, int len):base(dec, in_Renamed, len)
+ {
+
+ //convert from Asn1OctetString to RfcLdapURL here (then look at
+ // LdapResponse.getReferrals())
+ }
+
+ //*************************************************************************
+ // Accessors
+ //*************************************************************************
+
+ // inherited from SequenceOf
+ }
+}
diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcRelativeLdapDN.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcRelativeLdapDN.cs
new file mode 100755
index 00000000000..fb17d95e960
--- /dev/null
+++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcRelativeLdapDN.cs
@@ -0,0 +1,48 @@
+/******************************************************************************
+* The MIT License
+* Copyright (c) 2003 Novell Inc. www.novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the Software), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*******************************************************************************/
+//
+// Novell.Directory.Ldap.Rfc2251.RfcRelativeLdapDN.cs
+//
+// Author:
+// Sunil Kumar (Sunilk@novell.com)
+//
+// (C) 2003 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+
+namespace Novell.Directory.Ldap.Rfc2251
+{
+
+ /*
+ * Represents an Ldap Relative DN.
+ */
+ public class RfcRelativeLdapDN:RfcLdapString
+ {
+
+ /// <summary> </summary>
+ public RfcRelativeLdapDN(System.String s):base(s)
+ {
+ }
+ }
+}
diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcRequest.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcRequest.cs
new file mode 100755
index 00000000000..86efd5057bd
--- /dev/null
+++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcRequest.cs
@@ -0,0 +1,49 @@
+/******************************************************************************
+* The MIT License
+* Copyright (c) 2003 Novell Inc. www.novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the Software), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*******************************************************************************/
+//
+// Novell.Directory.Ldap.Rfc2251.RfcRequest.cs
+//
+// Author:
+// Sunil Kumar (Sunilk@novell.com)
+//
+// (C) 2003 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+
+
+namespace Novell.Directory.Ldap.Rfc2251
+{
+
+ /// <summary> This interface represents Protocol Operations that are requests from a
+ /// client.
+ /// </summary>
+ public interface RfcRequest
+ {
+ /// <summary> Builds a new request using the data from the this object.</summary>
+ RfcRequest dupRequest(System.String base_Renamed, System.String filter, bool reference);
+
+ /// <summary> Builds a new request using the data from the this object.</summary>
+ System.String getRequestDN();
+ }
+}
diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcResponse.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcResponse.cs
new file mode 100755
index 00000000000..4e1d69c628d
--- /dev/null
+++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcResponse.cs
@@ -0,0 +1,59 @@
+/******************************************************************************
+* The MIT License
+* Copyright (c) 2003 Novell Inc. www.novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the Software), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*******************************************************************************/
+//
+// Novell.Directory.Ldap.Rfc2251.RfcResponse.cs
+//
+// Author:
+// Sunil Kumar (Sunilk@novell.com)
+//
+// (C) 2003 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using Novell.Directory.Ldap.Asn1;
+
+namespace Novell.Directory.Ldap.Rfc2251
+{
+
+ /// <summary> This interface represents RfcLdapMessages that contain a response from a
+ /// server.
+ ///
+ /// <p>If the protocol operation of the RfcLdapMessage is of this type,
+ /// it contains at least an RfcLdapResult.</p>
+ /// </summary>
+ public interface RfcResponse
+ {
+
+ /// <summary> </summary>
+ Asn1Enumerated getResultCode();
+
+ /// <summary> </summary>
+ RfcLdapDN getMatchedDN();
+
+ /// <summary> </summary>
+ RfcLdapString getErrorMessage();
+
+ /// <summary> </summary>
+ RfcReferral getReferral();
+ }
+}
diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcSaslCredentials.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcSaslCredentials.cs
new file mode 100755
index 00000000000..c2507cdaeaa
--- /dev/null
+++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcSaslCredentials.cs
@@ -0,0 +1,66 @@
+/******************************************************************************
+* The MIT License
+* Copyright (c) 2003 Novell Inc. www.novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the Software), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*******************************************************************************/
+//
+// Novell.Directory.Ldap.Rfc2251.RfcSaslCredentials.cs
+//
+// Author:
+// Sunil Kumar (Sunilk@novell.com)
+//
+// (C) 2003 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using Novell.Directory.Ldap.Asn1;
+
+namespace Novell.Directory.Ldap.Rfc2251
+{
+
+ /// <summary> Represents Ldap Sasl Credentials.
+ ///
+ /// <pre>
+ /// SaslCredentials ::= SEQUENCE {
+ /// mechanism LdapString,
+ /// credentials OCTET STRING OPTIONAL }
+ /// </pre>
+ /// </summary>
+ public class RfcSaslCredentials:Asn1Sequence
+ {
+
+ //*************************************************************************
+ // Constructors for SaslCredentials
+ //*************************************************************************
+
+ /// <summary> </summary>
+ public RfcSaslCredentials(RfcLdapString mechanism):this(mechanism, null)
+ {
+ }
+
+ /// <summary> </summary>
+ public RfcSaslCredentials(RfcLdapString mechanism, Asn1OctetString credentials):base(2)
+ {
+ add(mechanism);
+ if (credentials != null)
+ add(credentials);
+ }
+ }
+}
diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcSearchRequest.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcSearchRequest.cs
new file mode 100755
index 00000000000..b67be6f75e3
--- /dev/null
+++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcSearchRequest.cs
@@ -0,0 +1,139 @@
+/******************************************************************************
+* The MIT License
+* Copyright (c) 2003 Novell Inc. www.novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the Software), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*******************************************************************************/
+//
+// Novell.Directory.Ldap.Rfc2251.RfcSearchRequest.cs
+//
+// Author:
+// Sunil Kumar (Sunilk@novell.com)
+//
+// (C) 2003 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using LdapException = Novell.Directory.Ldap.LdapException;
+using Novell.Directory.Ldap;
+using Novell.Directory.Ldap.Asn1;
+
+namespace Novell.Directory.Ldap.Rfc2251
+{
+
+ /// <summary> Represents an Ldap Search Request.
+ ///
+ /// <pre>
+ /// SearchRequest ::= [APPLICATION 3] SEQUENCE {
+ /// baseObject LdapDN,
+ /// scope ENUMERATED {
+ /// baseObject (0),
+ /// singleLevel (1),
+ /// wholeSubtree (2) },
+ /// derefAliases ENUMERATED {
+ /// neverDerefAliases (0),
+ /// derefInSearching (1),
+ /// derefFindingBaseObj (2),
+ /// derefAlways (3) },
+ /// sizeLimit INTEGER (0 .. maxInt),
+ /// timeLimit INTEGER (0 .. maxInt),
+ /// typesOnly BOOLEAN,
+ /// filter Filter,
+ /// attributes AttributeDescriptionList }
+ /// </pre>
+ /// </summary>
+ public class RfcSearchRequest:Asn1Sequence, RfcRequest
+ {
+
+ //*************************************************************************
+ // Constructors for SearchRequest
+ //*************************************************************************
+
+ /*
+ *
+ */
+ public RfcSearchRequest(RfcLdapDN baseObject, Asn1Enumerated scope, Asn1Enumerated derefAliases, Asn1Integer sizeLimit, Asn1Integer timeLimit, Asn1Boolean typesOnly, RfcFilter filter, RfcAttributeDescriptionList attributes):base(8)
+ {
+ add(baseObject);
+ add(scope);
+ add(derefAliases);
+ add(sizeLimit);
+ add(timeLimit);
+ add(typesOnly);
+ add(filter);
+ add(attributes);
+ return ;
+ }
+
+ /// <summary> Constructs a new Search Request copying from an existing request.</summary>
+ /* package */
+ internal RfcSearchRequest(Asn1Object[] origRequest, System.String base_Renamed, System.String filter, bool request):base(origRequest, origRequest.Length)
+ {
+
+ // Replace the base if specified, otherwise keep original base
+ if ((System.Object) base_Renamed != null)
+ {
+ set_Renamed(0, new RfcLdapDN(base_Renamed));
+ }
+
+ // If this is a reencode of a search continuation reference
+ // and if original scope was one-level, we need to change the scope to
+ // base so we don't return objects a level deeper than requested
+ if (request)
+ {
+ int scope = ((Asn1Enumerated) origRequest[1]).intValue();
+ if (scope == LdapConnection.SCOPE_ONE)
+ {
+ set_Renamed(1, new Asn1Enumerated(LdapConnection.SCOPE_BASE));
+ }
+ }
+ // Replace the filter if specified, otherwise keep original filter
+ if ((System.Object) filter != null)
+ {
+ set_Renamed(6, new RfcFilter(filter));
+ }
+ return ;
+ }
+
+ //*************************************************************************
+ // Accessors
+ //*************************************************************************
+
+ /// <summary> Override getIdentifier to return an application-wide id.
+ ///
+ /// <pre>
+ /// ID = CLASS: APPLICATION, FORM: CONSTRUCTED, TAG: 3. (0x63)
+ /// </pre>
+ /// </summary>
+ public override Asn1Identifier getIdentifier()
+ {
+ return new Asn1Identifier(Asn1Identifier.APPLICATION, true, LdapMessage.SEARCH_REQUEST);
+ }
+
+ public RfcRequest dupRequest(System.String base_Renamed, System.String filter, bool request)
+ {
+ return new RfcSearchRequest(toArray(), base_Renamed, filter, request);
+ }
+
+ public System.String getRequestDN()
+ {
+ return ((RfcLdapDN) get_Renamed(0)).stringValue();
+ }
+ }
+}
diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcSearchResultDone.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcSearchResultDone.cs
new file mode 100755
index 00000000000..b7f2314cb47
--- /dev/null
+++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcSearchResultDone.cs
@@ -0,0 +1,88 @@
+/******************************************************************************
+* The MIT License
+* Copyright (c) 2003 Novell Inc. www.novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the Software), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*******************************************************************************/
+//
+// Novell.Directory.Ldap.Rfc2251.RfcSearchResultDone.cs
+//
+// Author:
+// Sunil Kumar (Sunilk@novell.com)
+//
+// (C) 2003 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using Novell.Directory.Ldap;
+using Novell.Directory.Ldap.Asn1;
+
+namespace Novell.Directory.Ldap.Rfc2251
+{
+
+ /// <summary> Represents an Ldap Search Result Done Response.
+ ///
+ /// <pre>
+ /// SearchResultDone ::= [APPLICATION 5] LdapResult
+ /// </pre>
+ /// </summary>
+ public class RfcSearchResultDone:RfcLdapResult
+ {
+
+ //*************************************************************************
+ // Constructors for SearchResultDone
+ //*************************************************************************
+
+ /// <summary> Decode a search result done from the input stream.</summary>
+ [CLSCompliantAttribute(false)]
+ public RfcSearchResultDone(Asn1Decoder dec, System.IO.Stream in_Renamed, int len):base(dec, in_Renamed, len)
+ {
+ return ;
+ }
+
+ /// <summary> Constructs an RfcSearchResultDone from parameters.
+ ///
+ /// </summary>
+ /// <param name="resultCode">the result code of the operation
+ ///
+ /// </param>
+ /// <param name="matchedDN">the matched DN returned from the server
+ ///
+ /// </param>
+ /// <param name="errorMessage">the diagnostic message returned from the server
+ ///
+ /// </param>
+ /// <param name="referral">the referral(s) returned by the server
+ /// </param>
+ public RfcSearchResultDone(Asn1Enumerated resultCode, RfcLdapDN matchedDN, RfcLdapString errorMessage, RfcReferral referral):base(resultCode, matchedDN, errorMessage, referral)
+ {
+ return ;
+ }
+
+ //*************************************************************************
+ // Accessors
+ //*************************************************************************
+
+ /// <summary> Override getIdentifier to return an application-wide id.</summary>
+ public override Asn1Identifier getIdentifier()
+ {
+ return new Asn1Identifier(Asn1Identifier.APPLICATION, true, LdapMessage.SEARCH_RESULT);
+ }
+ }
+}
diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcSearchResultEntry.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcSearchResultEntry.cs
new file mode 100755
index 00000000000..9a127c916ab
--- /dev/null
+++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcSearchResultEntry.cs
@@ -0,0 +1,98 @@
+/******************************************************************************
+* The MIT License
+* Copyright (c) 2003 Novell Inc. www.novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the Software), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*******************************************************************************/
+//
+// Novell.Directory.Ldap.Rfc2251.RfcSearchResultEntry.cs
+//
+// Author:
+// Sunil Kumar (Sunilk@novell.com)
+//
+// (C) 2003 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using Novell.Directory.Ldap;
+using Novell.Directory.Ldap.Asn1;
+
+namespace Novell.Directory.Ldap.Rfc2251
+{
+
+ /// <summary> Represents an Ldap Search Result Entry.
+ ///
+ /// <pre>
+ /// SearchResultEntry ::= [APPLICATION 4] SEQUENCE {
+ /// objectName LdapDN,
+ /// attributes PartialAttributeList }
+ /// </pre>
+ /// </summary>
+ public class RfcSearchResultEntry:Asn1Sequence
+ {
+ /// <summary> </summary>
+ virtual public Asn1OctetString ObjectName
+ {
+ get
+ {
+ return (Asn1OctetString) get_Renamed(0);
+ }
+
+ }
+ /// <summary> </summary>
+ virtual public Asn1Sequence Attributes
+ {
+ get
+ {
+ return (Asn1Sequence) get_Renamed(1);
+ }
+
+ }
+
+ //*************************************************************************
+ // Constructors for SearchResultEntry
+ //*************************************************************************
+
+ /// <summary> The only time a client will create a SearchResultEntry is when it is
+ /// decoding it from an InputStream
+ /// </summary>
+ [CLSCompliantAttribute(false)]
+ public RfcSearchResultEntry(Asn1Decoder dec, System.IO.Stream in_Renamed, int len):base(dec, in_Renamed, len)
+ {
+
+ // Decode objectName
+ // set(0, new RfcLdapDN(((Asn1OctetString)get(0)).stringValue()));
+
+ // Create PartitalAttributeList. This does not need to be decoded, only
+ // typecast.
+ // set(1, new PartitalAttributeList());
+ return ;
+ }
+
+ //*************************************************************************
+ // Accessors
+ //*************************************************************************
+
+ /// <summary> Override getIdentifier to return an application-wide id.</summary>
+ public override Asn1Identifier getIdentifier()
+ {
+ return new Asn1Identifier(Asn1Identifier.APPLICATION, true, LdapMessage.SEARCH_RESPONSE);
+ }
+ }
+}
diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcSearchResultReference.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcSearchResultReference.cs
new file mode 100755
index 00000000000..e17d4e2dd3b
--- /dev/null
+++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcSearchResultReference.cs
@@ -0,0 +1,71 @@
+/******************************************************************************
+* The MIT License
+* Copyright (c) 2003 Novell Inc. www.novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the Software), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*******************************************************************************/
+//
+// Novell.Directory.Ldap.Rfc2251.RfcSearchResultReference.cs
+//
+// Author:
+// Sunil Kumar (Sunilk@novell.com)
+//
+// (C) 2003 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using Novell.Directory.Ldap;
+using Novell.Directory.Ldap.Asn1;
+
+namespace Novell.Directory.Ldap.Rfc2251
+{
+
+ /// <summary> Represents an Ldap Search Result Reference.
+ ///
+ /// <pre>
+ /// SearchResultReference ::= [APPLICATION 19] SEQUENCE OF LdapURL
+ /// </pre>
+ /// </summary>
+ public class RfcSearchResultReference:Asn1SequenceOf
+ {
+
+ //*************************************************************************
+ // Constructors for SearchResultReference
+ //*************************************************************************
+
+ /// <summary> The only time a client will create a SearchResultReference is when it is
+ /// decoding it from an InputStream
+ /// </summary>
+ [CLSCompliantAttribute(false)]
+ public RfcSearchResultReference(Asn1Decoder dec, System.IO.Stream in_Renamed, int len):base(dec, in_Renamed, len)
+ {
+ return ;
+ }
+
+ //*************************************************************************
+ // Accessors
+ //*************************************************************************
+
+ /// <summary> Override getIdentifier to return an application-wide id.</summary>
+ public override Asn1Identifier getIdentifier()
+ {
+ return new Asn1Identifier(Asn1Identifier.APPLICATION, true, LdapMessage.SEARCH_RESULT_REFERENCE);
+ }
+ }
+}
diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcSubstringFilter.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcSubstringFilter.cs
new file mode 100755
index 00000000000..fb8e6338b78
--- /dev/null
+++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcSubstringFilter.cs
@@ -0,0 +1,64 @@
+/******************************************************************************
+* The MIT License
+* Copyright (c) 2003 Novell Inc. www.novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the Software), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*******************************************************************************/
+//
+// Novell.Directory.Ldap.Rfc2251.RfcSubstringFilter.cs
+//
+// Author:
+// Sunil Kumar (Sunilk@novell.com)
+//
+// (C) 2003 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using Novell.Directory.Ldap.Asn1;
+
+namespace Novell.Directory.Ldap.Rfc2251
+{
+
+ /// <summary> Represents an Ldap Substring Filter.
+ ///
+ /// <pre>
+ /// SubstringFilter ::= SEQUENCE {
+ /// type AttributeDescription,
+ /// -- at least one must be present
+ /// substrings SEQUENCE OF CHOICE {
+ /// initial [0] LdapString,
+ /// any [1] LdapString,
+ /// final [2] LdapString } }
+ /// </pre>
+ /// </summary>
+ public class RfcSubstringFilter:Asn1Sequence
+ {
+
+ //*************************************************************************
+ // Constructors for SubstringFilter
+ //*************************************************************************
+
+ /// <summary> </summary>
+ public RfcSubstringFilter(RfcAttributeDescription type, Asn1SequenceOf substrings):base(2)
+ {
+ add(type);
+ add(substrings);
+ }
+ }
+}
diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcUnbindRequest.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcUnbindRequest.cs
new file mode 100755
index 00000000000..9a7ff6f08e1
--- /dev/null
+++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcUnbindRequest.cs
@@ -0,0 +1,83 @@
+/******************************************************************************
+* The MIT License
+* Copyright (c) 2003 Novell Inc. www.novell.com
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the Software), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*******************************************************************************/
+//
+// Novell.Directory.Ldap.Rfc2251.RfcUnbindRequest.cs
+//
+// Author:
+// Sunil Kumar (Sunilk@novell.com)
+//
+// (C) 2003 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using Novell.Directory.Ldap.Asn1;
+using Novell.Directory.Ldap;
+using Novell.Directory.Ldap.Utilclass;
+
+namespace Novell.Directory.Ldap.Rfc2251
+{
+
+ /// <summary> Represents the Ldap Unbind request.
+ ///
+ /// <pre>
+ /// UnbindRequest ::= [APPLICATION 2] NULL
+ /// </pre>
+ /// </summary>
+ public class RfcUnbindRequest:Asn1Null, RfcRequest
+ {
+
+ //*************************************************************************
+ // Constructor for UnbindRequest
+ //*************************************************************************
+
+ /// <summary> Construct an RfCUnbind Request</summary>
+ public RfcUnbindRequest():base()
+ {
+ return ;
+ }
+
+ //*************************************************************************
+ // Accessors
+ //*************************************************************************
+
+ /// <summary> Override getIdentifier to return an application-wide id.
+ /// <pre>
+ /// ID = CLASS: APPLICATION, FORM: PRIMITIVE, TAG: 2. (0x42)
+ /// </pre>
+ /// </summary>
+ public override Asn1Identifier getIdentifier()
+ {
+ return new Asn1Identifier(Asn1Identifier.APPLICATION, false, LdapMessage.UNBIND_REQUEST);
+ }
+
+ public RfcRequest dupRequest(System.String base_Renamed, System.String filter, bool request)
+ {
+ throw new LdapException(ExceptionMessages.NO_DUP_REQUEST, new System.Object[]{"unbind"}, LdapException.Ldap_NOT_SUPPORTED, (System.String) null);
+ }
+
+ public System.String getRequestDN()
+ {
+ return null;
+ }
+ }
+}