diff options
author | Sunil Kumar <sunilk@mono-cvs.ximian.com> | 2003-11-24 06:56:19 +0300 |
---|---|---|
committer | Sunil Kumar <sunilk@mono-cvs.ximian.com> | 2003-11-24 06:56:19 +0300 |
commit | e80ff96eb1282e11d48f8e80839539d5017a8cf1 (patch) | |
tree | 437cddbfe9b6f12833b1eef2a727e570b8b1dca7 /mcs/class/Novell.Directory.Ldap | |
parent | 88252fc702fb88a06e0b58a0757d04d56ede4f4b (diff) |
Class files implementing various LDAP Extensions
svn path=/trunk/mcs/; revision=20365
Diffstat (limited to 'mcs/class/Novell.Directory.Ldap')
29 files changed, 3845 insertions, 0 deletions
diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/AbortPartitionOperationRequest.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/AbortPartitionOperationRequest.cs new file mode 100755 index 00000000000..0e3ca8a5b78 --- /dev/null +++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/AbortPartitionOperationRequest.cs @@ -0,0 +1,99 @@ +/****************************************************************************** +* 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.Extensions.AbortPartitionOperationRequest.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; +using Novell.Directory.Ldap.Utilclass; + +namespace Novell.Directory.Ldap.Extensions +{ + + /// <summary> + /// Aborts the last partition operation that was requested on the + /// specified partition if the operation is still pending. + /// + /// <p>The AbortPartitionRequest extension uses the following OID:<br> + /// 2.16.840.1.113719.1.27.100.29</p> + /// + /// <p>The requestValue has the following format:<br> + /// + /// requestValue ::= <br> + /// flags INTEGER<br> + /// partitionDN LdapDN </p> + /// </summary> + public class AbortPartitionOperationRequest:LdapExtendedOperation + { + + /// <summary> Constructs an extended operation object for aborting a partition operation. + /// + /// </summary> + /// <param name="partitionDN">The distinguished name of the replica's + /// partition root.<br><br> + /// + /// </param> + /// <param name="flags">Determines whether all servers in the replica ring must + /// be up before proceeding. When set to zero, the status of the + /// servers is not checked. When set to Ldap_ENSURE_SERVERS_UP, + /// all servers must be up for the operation to proceed. + /// + /// </param> + /// <exception cref=""> LdapException A general exception which includes an error message + /// and an Ldap error code. + /// </exception> + public AbortPartitionOperationRequest(System.String partitionDN, int flags):base(ReplicationConstants.ABORT_NAMING_CONTEXT_OP_REQ, null) + { + + try + { + + if ((System.Object) partitionDN == null) + throw new System.ArgumentException(ExceptionMessages.PARAM_ERROR); + + System.IO.MemoryStream encodedData = new System.IO.MemoryStream(); + LBEREncoder encoder = new LBEREncoder(); + + + Asn1Integer asn1_flags = new Asn1Integer(flags); + Asn1OctetString asn1_partitionDN = new Asn1OctetString(partitionDN); + + asn1_flags.encode(encoder, encodedData); + asn1_partitionDN.encode(encoder, encodedData); + + setValue(SupportClass.ToSByteArray(encodedData.ToArray())); + } + catch (System.IO.IOException ioe) + { + throw new LdapException(ExceptionMessages.ENCODING_ERROR, LdapException.ENCODING_ERROR, (System.String) null); + } + } + } +} diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/AddReplicaRequest.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/AddReplicaRequest.cs new file mode 100755 index 00000000000..9f7c62514e5 --- /dev/null +++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/AddReplicaRequest.cs @@ -0,0 +1,128 @@ +/****************************************************************************** +* 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.Extensions.AddReplicaRequest.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; +using Novell.Directory.Ldap.Utilclass; + +namespace Novell.Directory.Ldap.Extensions +{ + + /// <summary> + /// Adds a replica to the specified directory server. + /// + /// <p>To add a replica to a particular server, you must create an instance of + /// this class and then call the extendedOperation method with this + /// object as the required LdapExtendedOperation parameter.</p> + /// + /// <p>The addReplicaRequest extension uses the following OID:<br> + /// 2.16.840.1.113719.1.27.100.7</p> + /// + /// <p>The requestValue has the following format:<br> + /// + /// requestValue ::=<br> + /// flags INTEGER<br> + /// replicaType INTEGER<br> + /// serverName LdapDN<br> + /// dn LdapDN</p> + /// </summary> + public class AddReplicaRequest:LdapExtendedOperation + { + + /// <summary> + /// Constructs a new extended operation object for adding a replica to the + /// specified server. + /// + /// </summary> + /// <param name="dn">The distinguished name of the replica's partition root.<br><br> + /// + /// </param> + /// <param name="serverDN">The server on which the new replica will be added.<br><br> + /// + /// </param> + /// <param name="replicaType">The type of replica to add. The replica + /// types are defined in the ReplicationConstants class.<br><br> + /// + /// </param> + /// <param name="flags">Specifies whether all servers in the replica ring must be up + /// before proceeding. When set to zero, the status of the servers is not + /// checked. When set to Ldap_ENSURE_SERVERS_UP, all servers must be up for the + /// operation to proceed. + /// + /// </param> + /// <exception cref=""> LdapException A general exception which includes an error message + /// and an Ldap error code. + /// + /// </exception> + /// <seealso cref="ReplicationConstants#Ldap_RT_MASTER"> + /// </seealso> + /// <seealso cref="ReplicationConstants#Ldap_RT_SECONDARY"> + /// </seealso> + /// <seealso cref="ReplicationConstants#Ldap_RT_READONLY"> + /// </seealso> + /// <seealso cref="ReplicationConstants#Ldap_RT_SUBREF"> + /// </seealso> + /// <seealso cref="ReplicationConstants#Ldap_RT_SPARSE_WRITE"> + /// </seealso> + /// <seealso cref="ReplicationConstants#Ldap_RT_SPARSE_READ"> + /// </seealso> + public AddReplicaRequest(System.String dn, System.String serverDN, int replicaType, int flags):base(ReplicationConstants.ADD_REPLICA_REQ, null) + { + + try + { + + if (((System.Object) dn == null) || ((System.Object) serverDN == null)) + throw new System.ArgumentException(ExceptionMessages.PARAM_ERROR); + + System.IO.MemoryStream encodedData = new System.IO.MemoryStream(); + LBEREncoder encoder = new LBEREncoder(); + + Asn1Integer asn1_flags = new Asn1Integer(flags); + Asn1Integer asn1_replicaType = new Asn1Integer(replicaType); + Asn1OctetString asn1_serverDN = new Asn1OctetString(serverDN); + Asn1OctetString asn1_dn = new Asn1OctetString(dn); + + asn1_flags.encode(encoder, encodedData); + asn1_replicaType.encode(encoder, encodedData); + asn1_serverDN.encode(encoder, encodedData); + asn1_dn.encode(encoder, encodedData); + + setValue(SupportClass.ToSByteArray(encodedData.ToArray())); + } + catch (System.IO.IOException ioe) + { + throw new LdapException(ExceptionMessages.ENCODING_ERROR, LdapException.ENCODING_ERROR, (System.String) null); + } + } + } +} diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/ChangeReplicaTypeRequest.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/ChangeReplicaTypeRequest.cs new file mode 100755 index 00000000000..790dbbb10de --- /dev/null +++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/ChangeReplicaTypeRequest.cs @@ -0,0 +1,130 @@ +/****************************************************************************** +* 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.Extensions.ChangeReplicaTypeRequest.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; +using Novell.Directory.Ldap.Utilclass; + +namespace Novell.Directory.Ldap.Extensions +{ + + /// <summary> + /// Changes the type of the replica that resides + /// on the specified directory server. + /// + /// <p>To change a replica's type, you must create an instance of this class and + /// then call the extendedOperation method with this object as the required + /// LdapExtendedOperation parameter.</p> + /// + /// <p>The changeReplicaTypeRequest extension uses the following OID:<br> + /// 2.16.840.1.113719.1.27.100.15</p> + /// + /// <p>The requestValue has the following format:<br> + /// + /// requestValue ::=<br> + /// flags INTEGER<br> + /// replicaType INTEGER<br> + /// serverName LdapDN<br> + /// dn LdapDN</p> + /// </summary> + public class ChangeReplicaTypeRequest:LdapExtendedOperation + { + + /// <summary> + /// Constructs a new extended operation object for changing a replica's type. + /// + /// </summary> + /// <param name="dn"> The distinguished name of the replica's + /// partition root. + /// <br><br> + /// </param> + /// <param name="serverDN"> The server on which the replica resides. + /// <br><br> + /// + /// </param> + /// <param name="replicaType"> The new replica type. The replica types are defined + /// in the ReplicationConstants class. + /// <br><br> + /// </param> + /// <param name="flags"> Specifies whether all servers in the replica ring must be up + /// before proceeding. When set to zero, the status of the servers is + /// not checked. When set to Ldap_ENSURE_SERVERS_UP, all servers must be + /// up for the operation to proceed. + /// + /// </param> + /// <exception cref=""> LdapException A general exception which includes an error message + /// and an Ldap error code. + /// + /// </exception> + /// <seealso cref="ReplicationConstants#Ldap_RT_MASTER"> + /// </seealso> + /// <seealso cref="ReplicationConstants#Ldap_RT_SECONDARY"> + /// </seealso> + /// <seealso cref="ReplicationConstants#Ldap_RT_READONLY"> + /// </seealso> + /// <seealso cref="ReplicationConstants#Ldap_RT_SUBREF"> + /// </seealso> + /// <seealso cref="ReplicationConstants#Ldap_RT_SPARSE_WRITE"> + /// </seealso> + /// <seealso cref="ReplicationConstants#Ldap_RT_SPARSE_READ"> + /// </seealso> + public ChangeReplicaTypeRequest(System.String dn, System.String serverDN, int replicaType, int flags):base(ReplicationConstants.CHANGE_REPLICA_TYPE_REQ, null) + { + + try + { + + if (((System.Object) dn == null) || ((System.Object) serverDN == null)) + throw new System.ArgumentException(ExceptionMessages.PARAM_ERROR); + + System.IO.MemoryStream encodedData = new System.IO.MemoryStream(); + LBEREncoder encoder = new LBEREncoder(); + + Asn1Integer asn1_flags = new Asn1Integer(flags); + Asn1Integer asn1_replicaType = new Asn1Integer(replicaType); + Asn1OctetString asn1_serverDN = new Asn1OctetString(serverDN); + Asn1OctetString asn1_dn = new Asn1OctetString(dn); + + asn1_flags.encode(encoder, encodedData); + asn1_replicaType.encode(encoder, encodedData); + asn1_serverDN.encode(encoder, encodedData); + asn1_dn.encode(encoder, encodedData); + + setValue(SupportClass.ToSByteArray(encodedData.ToArray())); + } + catch (System.IO.IOException ioe) + { + throw new LdapException(ExceptionMessages.ENCODING_ERROR, LdapException.ENCODING_ERROR, (System.String) null); + } + } + } +} diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/GetBindDNRequest.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/GetBindDNRequest.cs new file mode 100755 index 00000000000..c67d8705152 --- /dev/null +++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/GetBindDNRequest.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.Extensions.GetBindDNRequest.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; +using Novell.Directory.Ldap.Utilclass; + +namespace Novell.Directory.Ldap.Extensions +{ + + /// <summary> Returns the distingusihed name of the object your are logged in as. + /// + /// <p>To use this class, you must create an instance of the + /// class and then call the extendedOperation method with this + /// object as the required LdapExtendedOperation parameter.</p> + /// + /// <p>The returned LdapExtendedResponse object can then be converted to + /// a GetBindDNResponse object with the ExtendedREsponseFactory + /// class. This object contains methods for retrieving the distinguished + /// name.</p> + /// + /// <p>The GetBindDNRequest extension uses the following OID:<br> + /// 2.16.840.1.113719.1.27.100.31</p> + /// + /// <p>The request value has a value of null.</p> + /// + /// </summary> + public class GetBindDNRequest:LdapExtendedOperation + { + + /// <summary> Constructs an extended operation object for retrieving the bind dn. + /// + /// </summary> + /// <exception cref=""> LdapException A general exception which includes an error + /// message and an Ldap error code. + /// </exception> + + public GetBindDNRequest():base(ReplicationConstants.GET_IDENTITY_NAME_REQ, null) + { + } + } +} diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/GetBindDNResponse.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/GetBindDNResponse.cs new file mode 100755 index 00000000000..2da6321b94b --- /dev/null +++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/GetBindDNResponse.cs @@ -0,0 +1,110 @@ +/****************************************************************************** +* 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.Extensions.GetBindDNResponse.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; +using Novell.Directory.Ldap.Utilclass; +using Novell.Directory.Ldap.Rfc2251; + +namespace Novell.Directory.Ldap.Extensions +{ + + /// <summary> Retrieves the identity from an GetBindDNResponse object. + /// + /// <p>An object in this class is generated from an LdapExtendedResponse object + /// using the ExtendedResponseFactory class.</p> + /// + /// <p>The GetBindDNResponse extension uses the following OID:<br> + /// 2.16.840.1.113719.1.27.100.32 </p> + /// + /// </summary> + public class GetBindDNResponse:LdapExtendedResponse + { + /// <summary> Returns the identity of the object. + /// + /// </summary> + /// <returns> A string value specifying the bind dn returned by the server. + /// </returns> + virtual public System.String Identity + { + get + { + return identity; + } + + } + + // Identity returned by the server + private System.String identity; + + /// <summary> Constructs an object from the responseValue which contains the bind dn. + /// + /// <p>The constructor parses the responseValue which has the following + /// format:<br> + /// responseValue ::=<br> + /// identity OCTET STRING</p> + /// + /// </summary> + /// <exception cref=""> IOException The return value could not be decoded. + /// </exception> + public GetBindDNResponse(RfcLdapMessage rfcMessage):base(rfcMessage) + { + + if (ResultCode == LdapException.SUCCESS) + { + // parse the contents of the reply + sbyte[] returnedValue = this.Value; + if (returnedValue == null) + throw new System.IO.IOException("No returned value"); + + // Create a decoder object + LBERDecoder decoder = new LBERDecoder(); + if (decoder == null) + throw new System.IO.IOException("Decoding error"); + + // The only parameter returned should be an octet string + Asn1OctetString asn1_identity = (Asn1OctetString) decoder.decode(returnedValue); + if (asn1_identity == null) + throw new System.IO.IOException("Decoding error"); + + // Convert to normal string object + identity = asn1_identity.stringValue(); + if ((System.Object) identity == null) + throw new System.IO.IOException("Decoding error"); + } + else + { + identity = ""; + } + } + } +} diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/GetEffectivePrivilegesRequest.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/GetEffectivePrivilegesRequest.cs new file mode 100755 index 00000000000..c1e07177899 --- /dev/null +++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/GetEffectivePrivilegesRequest.cs @@ -0,0 +1,111 @@ +/****************************************************************************** +* 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.Extensions.GetEffectivePrivilegesRequest.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; +using Novell.Directory.Ldap.Utilclass; + +namespace Novell.Directory.Ldap.Extensions +{ + + /// <summary> + /// Returns the effective rights of one object to an attribute of another object. + /// + /// <p>To use this class, you must instantiate an object of this class and then + /// call the extendedOperation method with this object as the required + /// LdapExtendedOperation parameter.</p> + /// + /// <p>The returned LdapExtendedResponse object can then be converted to + /// a GetEffectivePrivilegesResponse object with the ExtendedResponseFactory class. + /// The GetEffectivePrivilegesResponse class contains methods for + /// retrieving the effective rights.</p> + /// + /// <p>The getEffectivePrivilegesRequest extension uses the following OID:<br> + /// 2.16.840.1.113719.1.27.100.33</p> + /// + /// <p>The requestValue has the following format:<br> + /// + /// requestValue ::=<br> + /// dn LdapDN<br> + /// trusteeDN LdapDN<br> + /// attrName LdapDN </p> + /// </summary> + public class GetEffectivePrivilegesRequest:LdapExtendedOperation + { + + /// <summary> Constructs an extended operation object for checking effective rights. + /// + /// </summary> + /// <param name="dn"> The distinguished name of the entry whose attribute is + /// being checked. + /// <br><br> + /// </param> + /// <param name="trusteeDN">The distinguished name of the entry whose trustee rights + /// are being returned + /// <br><br> + /// </param> + /// <param name="attrName"> The Ldap attribute name. + /// + /// </param> + /// <exception cref=""> LdapException A general exception which includes an error + /// message and an Ldap error code. + /// </exception> + + public GetEffectivePrivilegesRequest(System.String dn, System.String trusteeDN, System.String attrName):base(ReplicationConstants.GET_EFFECTIVE_PRIVILEGES_REQ, null) + { + + try + { + + if (((System.Object) dn == null)) + throw new System.ArgumentException(ExceptionMessages.PARAM_ERROR); + + System.IO.MemoryStream encodedData = new System.IO.MemoryStream(); + LBEREncoder encoder = new LBEREncoder(); + + Asn1OctetString asn1_dn = new Asn1OctetString(dn); + Asn1OctetString asn1_trusteeDN = new Asn1OctetString(trusteeDN); + Asn1OctetString asn1_attrName = new Asn1OctetString(attrName); + + asn1_dn.encode(encoder, encodedData); + asn1_trusteeDN.encode(encoder, encodedData); + asn1_attrName.encode(encoder, encodedData); + + setValue(SupportClass.ToSByteArray(encodedData.ToArray())); + } + catch (System.IO.IOException ioe) + { + throw new LdapException(ExceptionMessages.ENCODING_ERROR, LdapException.ENCODING_ERROR, (System.String) null); + } + } + } +} diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/GetEffectivePrivilegesResponse.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/GetEffectivePrivilegesResponse.cs new file mode 100755 index 00000000000..4550f54b47f --- /dev/null +++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/GetEffectivePrivilegesResponse.cs @@ -0,0 +1,123 @@ +/****************************************************************************** +* 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.Extensions.GetEffectivePrivilegesResponse.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; +using Novell.Directory.Ldap.Utilclass; +using Novell.Directory.Ldap.Rfc2251; + +namespace Novell.Directory.Ldap.Extensions +{ + + /// <summary> Retrieves the effective rights from an GetEffectivePrivilegesResponse object. + /// + /// <p>An object in this class is generated from an ExtendedResponse object + /// using the ExtendedResponseFactory class.</p> + /// + /// <p>The getEffectivePrivilegesResponse extension uses the following OID:<br> + /// 2.16.840.1.113719.1.27.100.34</p> + /// + /// </summary> + public class GetEffectivePrivilegesResponse:LdapExtendedResponse + { + /// <summary> Returns the effective privileges. + /// + /// <p>See the ReplicationConstants class for the privilege flags. + /// + /// </summary> + /// <returns> A flag which is a combination of zero or more privilege flags as + /// returned by the server. + /// + /// </returns> + /// <seealso cref="LdapDSConstants#Ldap_DS_ATTR_COMPARE"> + /// </seealso> + /// <seealso cref="LdapDSConstants#Ldap_DS_ATTR_READ"> + /// </seealso> + /// <seealso cref="LdapDSConstants#Ldap_DS_ATTR_WRITE"> + /// </seealso> + /// <seealso cref="LdapDSConstants#Ldap_DS_ATTR_SELF"> + /// </seealso> + /// <seealso cref="LdapDSConstants#Ldap_DS_ATTR_SUPERVISOR"> + /// </seealso> + /// <seealso cref="LdapDSConstants#Ldap_DS_ATTR_INHERIT_CTL"> + /// </seealso> + virtual public int Privileges + { + get + { + return privileges; + } + + } + + // Identity returned by the server + private int privileges; + + /// <summary> Constructs an object from the responseValue which contains the effective + /// privileges. + /// + /// <p>The constructor parses the responseValue which has the following + /// format:<br> + /// responseValue ::=<br> + /// privileges INTEGER</p> + /// + /// </summary> + /// <exception cref=""> IOException The responseValue could not be decoded. + /// </exception> + public GetEffectivePrivilegesResponse(RfcLdapMessage rfcMessage):base(rfcMessage) + { + + if (ResultCode == LdapException.SUCCESS) + { + // parse the contents of the reply + sbyte[] returnedValue = this.Value; + if (returnedValue == null) + throw new System.IO.IOException("No returned value"); + + // Create a decoder object + LBERDecoder decoder = new LBERDecoder(); + if (decoder == null) + throw new System.IO.IOException("Decoding error"); + + Asn1Integer asn1_privileges = (Asn1Integer) decoder.decode(returnedValue); + if (asn1_privileges == null) + throw new System.IO.IOException("Decoding error"); + + privileges = asn1_privileges.intValue(); + } + else + { + privileges = 0; + } + } + } +} diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/GetReplicaInfoRequest.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/GetReplicaInfoRequest.cs new file mode 100755 index 00000000000..0a65d197b87 --- /dev/null +++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/GetReplicaInfoRequest.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.Extensions.GetReplicaInfoRequest.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; +using Novell.Directory.Ldap.Utilclass; + +namespace Novell.Directory.Ldap.Extensions +{ + + /// <summary> + /// Reads information about a replica. + /// + /// <p>The information available includes such items as replicas state, last + /// modification time, and replica type. </p> + /// + /// <p>To read other information about a replica, you must + /// create an instance of this class and then call the + /// extendedOperation method with this object as the required + /// LdapExtendedOperation parameter.</p> + /// + /// <p>The getReplicaInfoRequest extension uses the following OID:<br> + /// 2.16.840.1.113719.1.27.100.17</p> + /// + /// <p>The requestValue has the following format:<br> + /// + /// requestValue ::=<br> + /// serverDN LdapDN<br> + /// partitionDN LdapDN</p> + /// </summary> + public class GetReplicaInfoRequest:LdapExtendedOperation + { + + /// <summary> + /// Constructs an extended operations object for reading replica information. + /// + /// </summary> + /// <param name="serverDN">The server on which the replica resides. + /// <br><br> + /// </param> + /// <param name="partitionDN">The distinguished name of the replica to be read. + /// + /// </param> + /// <exception cref=""> LdapException A general exception which includes an error + /// message and an Ldap error code. + /// </exception> + public GetReplicaInfoRequest(System.String serverDN, System.String partitionDN):base(ReplicationConstants.GET_REPLICA_INFO_REQ, null) + { + + try + { + + if (((System.Object) serverDN == null) || ((System.Object) partitionDN == null)) + throw new System.ArgumentException(ExceptionMessages.PARAM_ERROR); + + System.IO.MemoryStream encodedData = new System.IO.MemoryStream(); + LBEREncoder encoder = new LBEREncoder(); + + Asn1OctetString asn1_serverDN = new Asn1OctetString(serverDN); + Asn1OctetString asn1_partitionDN = new Asn1OctetString(partitionDN); + + asn1_serverDN.encode(encoder, encodedData); + asn1_partitionDN.encode(encoder, encodedData); + + setValue(SupportClass.ToSByteArray(encodedData.ToArray())); + } + catch (System.IO.IOException ioe) + { + throw new LdapException(ExceptionMessages.ENCODING_ERROR, LdapException.ENCODING_ERROR, (System.String) null); + } + } + } +} diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/GetReplicaInfoResponse.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/GetReplicaInfoResponse.cs new file mode 100755 index 00000000000..3e58e198eea --- /dev/null +++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/GetReplicaInfoResponse.cs @@ -0,0 +1,306 @@ +/****************************************************************************** +* 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.Extensions.GetReplicaInfoResponse.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; +using Novell.Directory.Ldap.Utilclass; +using Novell.Directory.Ldap.Rfc2251; + +namespace Novell.Directory.Ldap.Extensions +{ + + /// <summary> Retrieves the replica information from a GetReplicaInfoResponse object. + /// + /// <p>An object in this class is generated from an ExtendedResponse using the + /// ExtendedResponseFactory class.</p> + /// + /// <p>The getReplicaInfoResponse extension uses the following OID:<br> + /// 2.16.840.1.113719.1.27.100.18</p> + /// + /// </summary> + public class GetReplicaInfoResponse:LdapExtendedResponse + { + + // Other info as returned by the server + private int partitionID; + private int replicaState; + private int modificationTime; + private int purgeTime; + private int localPartitionID; + private System.String partitionDN; + private int replicaType; + private int flags; + + /// <summary> Constructs an object from the responseValue which contains the + /// replica information. + /// + /// <p>The constructor parses the responseValue which has the following + /// format:<br> + /// responseValue ::=<br> + /// partitionID INTEGER<br> + /// replicaState INTEGER<br> + /// modificationTime INTEGER<br> + /// purgeTime INTEGER<br> + /// localPartitionID INTEGER<br> + /// partitionDN OCTET STRING<br> + /// replicaType INTEGER<br> + /// flags INTEGER</p> + /// + /// </summary> + /// <exception cref=""> IOException The response value could not be decoded. + /// </exception> + public GetReplicaInfoResponse(RfcLdapMessage rfcMessage):base(rfcMessage) + { + + if (ResultCode == LdapException.SUCCESS) + { + // parse the contents of the reply + sbyte[] returnedValue = this.Value; + if (returnedValue == null) + throw new System.IO.IOException("No returned value"); + + // Create a decoder object + LBERDecoder decoder = new LBERDecoder(); + if (decoder == null) + throw new System.IO.IOException("Decoding error"); + + // Parse the parameters in the order + + System.IO.MemoryStream currentPtr = new System.IO.MemoryStream(SupportClass.ToByteArray(returnedValue)); + + // Parse partitionID + Asn1Integer asn1_partitionID = (Asn1Integer) decoder.decode(currentPtr); + if (asn1_partitionID == null) + throw new System.IO.IOException("Decoding error"); + + partitionID = asn1_partitionID.intValue(); + + + // Parse replicaState + Asn1Integer asn1_replicaState = (Asn1Integer) decoder.decode(currentPtr); + if (asn1_replicaState == null) + throw new System.IO.IOException("Decoding error"); + + replicaState = asn1_replicaState.intValue(); + + // Parse modificationTime + Asn1Integer asn1_modificationTime = (Asn1Integer) decoder.decode(currentPtr); + if (asn1_modificationTime == null) + throw new System.IO.IOException("Decoding error"); + + modificationTime = asn1_modificationTime.intValue(); + + // Parse purgeTime + Asn1Integer asn1_purgeTime = (Asn1Integer) decoder.decode(currentPtr); + if (asn1_purgeTime == null) + throw new System.IO.IOException("Decoding error"); + + purgeTime = asn1_purgeTime.intValue(); + + // Parse localPartitionID + Asn1Integer asn1_localPartitionID = (Asn1Integer) decoder.decode(currentPtr); + if (asn1_localPartitionID == null) + throw new System.IO.IOException("Decoding error"); + + localPartitionID = asn1_localPartitionID.intValue(); + + // Parse partitionDN + Asn1OctetString asn1_partitionDN = (Asn1OctetString) decoder.decode(currentPtr); + if (asn1_partitionDN == null) + throw new System.IO.IOException("Decoding error"); + + partitionDN = asn1_partitionDN.stringValue(); + if ((System.Object) partitionDN == null) + throw new System.IO.IOException("Decoding error"); + + + // Parse replicaType + Asn1Integer asn1_replicaType = (Asn1Integer) decoder.decode(currentPtr); + if (asn1_replicaType == null) + throw new System.IO.IOException("Decoding error"); + + replicaType = asn1_replicaType.intValue(); + + + // Parse flags + Asn1Integer asn1_flags = (Asn1Integer) decoder.decode(currentPtr); + if (asn1_flags == null) + throw new System.IO.IOException("Decoding error"); + + flags = asn1_flags.intValue(); + } + else + { + partitionID = 0; + replicaState = 0; + modificationTime = 0; + purgeTime = 0; + localPartitionID = 0; + partitionDN = ""; + replicaType = 0; + flags = 0; + } + } + + + /// <summary> Returns the numeric identifier for the partition. + /// + /// </summary> + /// <returns> Integer value specifying the partition ID. + /// </returns> + public virtual int getpartitionID() + { + return partitionID; + } + + /// <summary> Returns the current state of the replica. + /// + /// </summary> + /// <returns> Integer value specifying the current state of the replica. See + /// ReplicationConstants class for possible values for this field. + /// + /// </returns> + /// <seealso cref="ReplicationConstants#Ldap_RS_BEGIN_ADD"> + /// </seealso> + /// <seealso cref="ReplicationConstants#Ldap_RS_DEAD_REPLICA"> + /// </seealso> + /// <seealso cref="ReplicationConstants#Ldap_RS_DYING_REPLICA"> + /// </seealso> + /// <seealso cref="ReplicationConstants#Ldap_RS_JS_0"> + /// </seealso> + /// <seealso cref="ReplicationConstants#Ldap_RS_JS_1"> + /// </seealso> + /// <seealso cref="ReplicationConstants#Ldap_RS_JS_2"> + /// </seealso> + /// <seealso cref="ReplicationConstants#Ldap_RS_LOCKED"> + /// </seealso> + /// <seealso cref="ReplicationConstants#Ldap_RS_MASTER_DONE"> + /// </seealso> + /// <seealso cref="ReplicationConstants#Ldap_RS_MASTER_START"> + /// </seealso> + /// <seealso cref="ReplicationConstants#Ldap_RS_SS_0"> + /// </seealso> + /// <seealso cref="ReplicationConstants#Ldap_RS_TRANSITION_ON"> + /// </seealso> + public virtual int getreplicaState() + { + return replicaState; + } + + + + /// <summary> Returns the time of the most recent modification. + /// + /// </summary> + /// <returns> Integer value specifying the last modification time. + /// </returns> + public virtual int getmodificationTime() + { + return modificationTime; + } + + + /// <summary> Returns the most recent time in which all data has been synchronized. + /// + /// </summary> + /// <returns> Integer value specifying the last purge time. + /// </returns> + public virtual int getpurgeTime() + { + return purgeTime; + } + + /// <summary> Returns the local numeric identifier for the replica. + /// + /// </summary> + /// <returns> Integer value specifying the local ID of the partition. + /// </returns> + public virtual int getlocalPartitionID() + { + return localPartitionID; + } + + /// <summary> Returns the distinguished name of the partition. + /// + /// </summary> + /// <returns> String value specifying the name of the partition read. + /// </returns> + public virtual System.String getpartitionDN() + { + return partitionDN; + } + + /// <summary> Returns the replica type. + /// + /// <p>See the ReplicationConstants class for possible values for + /// this field.</p> + /// + /// </summary> + /// <returns> Integer identifying the type of the replica. + /// + /// </returns> + /// <seealso cref="ReplicationConstants#Ldap_RT_MASTER"> + /// </seealso> + /// <seealso cref="ReplicationConstants#Ldap_RT_SECONDARY"> + /// </seealso> + /// <seealso cref="ReplicationConstants#Ldap_RT_READONLY"> + /// </seealso> + /// <seealso cref="ReplicationConstants#Ldap_RT_SUBREF"> + /// </seealso> + /// <seealso cref="ReplicationConstants#Ldap_RT_SPARSE_WRITE"> + /// </seealso> + /// <seealso cref="ReplicationConstants#Ldap_RT_SPARSE_READ"> + /// </seealso> + public virtual int getreplicaType() + { + return replicaType; + } + + /// <summary> Returns flags that specify whether the replica is busy or is a boundary. + /// + /// <p>See the ReplicationConstants class for possible values for + /// this field.</p> + /// + /// </summary> + /// <returns> Integer value specifying the flags for the replica. + /// + /// </returns> + /// <seealso cref="ReplicationConstants#Ldap_DS_FLAG_BUSY"> + /// </seealso> + /// <seealso cref="ReplicationConstants#Ldap_DS_FLAG_BOUNDARY"> + /// </seealso> + public virtual int getflags() + { + return flags; + } + } +} diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/GetReplicationFilterRequest.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/GetReplicationFilterRequest.cs new file mode 100755 index 00000000000..4183e83c999 --- /dev/null +++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/GetReplicationFilterRequest.cs @@ -0,0 +1,96 @@ +/****************************************************************************** +* 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.Extensions.GetReplicationFilterRequest.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; +using Novell.Directory.Ldap.Utilclass; + +namespace Novell.Directory.Ldap.Extensions +{ + + /// <summary> + /// Gets the Replication filter for all replicas on the server. + /// + /// <p>The filter is returned as an array of classnames-attribute names pairs. </p> + /// + /// <p>To get the filter for all replicas on a specific server, you must + /// create an instance of this class and then call the + /// extendedOperation method with this object as the required + /// LdapExtendedOperation parameter.</p> + /// + /// <p>The GetReplicationFilterRequest extension uses the following OID:<br> + /// 2.16.840.1.113719.1.27.100.37</p> + /// + /// <p>The requestValue has the following format:<br> + /// + /// requestValue ::=<br> + /// serverName LdapDN</p> + /// </summary> + public class GetReplicationFilterRequest:LdapExtendedOperation + { + + /// <summary> + /// Constructs an extended operations object which contains the ber encoded + /// replication filter. + /// + /// </summary> + /// <param name="serverDN">The server whose replication filter needs to be read + /// <br><br> + /// </param> + /// <exception cref=""> LdapException A general exception which includes an error + /// message and an Ldap error code. + /// </exception> + public GetReplicationFilterRequest(System.String serverDN):base(ReplicationConstants.GET_REPLICATION_FILTER_REQ, null) + { + + try + { + + if ((System.Object) serverDN == null) + throw new System.ArgumentException(ExceptionMessages.PARAM_ERROR); + + System.IO.MemoryStream encodedData = new System.IO.MemoryStream(); + LBEREncoder encoder = new LBEREncoder(); + + Asn1OctetString asn1_serverDN = new Asn1OctetString(serverDN); + + // Add the serverDN to encoded data + asn1_serverDN.encode(encoder, encodedData); + setValue(SupportClass.ToSByteArray(encodedData.ToArray())); + } + catch (System.IO.IOException ioe) + { + throw new LdapException(ExceptionMessages.ENCODING_ERROR, LdapException.ENCODING_ERROR, (System.String) null); + } + } + } +} diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/GetReplicationFilterResponse.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/GetReplicationFilterResponse.cs new file mode 100755 index 00000000000..b947a826945 --- /dev/null +++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/GetReplicationFilterResponse.cs @@ -0,0 +1,165 @@ +/****************************************************************************** +* 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.Extensions.GetReplicationFilterResponse.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; +using Novell.Directory.Ldap.Utilclass; +using Novell.Directory.Ldap.Rfc2251; + +namespace Novell.Directory.Ldap.Extensions +{ + + /// <summary> This object represent the filter returned fom a GetReplicationFilterRequest. + /// + /// <p>An object in this class is generated from an ExtendedResponse object + /// using the ExtendedResponseFactory class.</p> + /// + /// <p>The GetReplicationFilterResponse extension uses the following OID:<br> + /// 2.16.840.1.113719.1.27.100.38</p> + /// + /// </summary> + public class GetReplicationFilterResponse:LdapExtendedResponse + { + /// <summary> Returns the replicationFilter as an array of classname-attribute name pairs + /// + /// </summary> + /// <returns> String array contining a two dimensional array of strings. The first + /// element of each array is the class name the others are the attribute names + /// </returns> + virtual public System.String[][] ReplicationFilter + { + get + { + return returnedFilter; + } + + } + + + + // Replication filter returned by the server goes here + internal System.String[][] returnedFilter; + + /// <summary> Constructs an object from the responseValue which contains the replication + /// filter. + /// + /// <p>The constructor parses the responseValue which has the following + /// format:<br> + /// responseValue ::=<br> + /// SEQUENCE of SEQUENCE {</p> + /// classname OCTET STRING</p> + /// SEQUENCE of ATTRIBUTES</p> + /// }</p> + /// where</p> + /// ATTRIBUTES:: OCTET STRING</p> + /// + /// </summary> + /// <exception cref=""> IOException The responseValue could not be decoded. + /// </exception> + public GetReplicationFilterResponse(RfcLdapMessage rfcMessage):base(rfcMessage) + { + + if (ResultCode != LdapException.SUCCESS) + { + returnedFilter = new System.String[0][]; + for (int i = 0; i < 0; i++) + { + returnedFilter[i] = new System.String[0]; + } + } + else + { + // parse the contents of the reply + sbyte[] returnedValue = this.Value; + if (returnedValue == null) + throw new System.IO.IOException("No returned value"); + + // Create a decoder object + LBERDecoder decoder = new LBERDecoder(); + if (decoder == null) + throw new System.IO.IOException("Decoding error"); + + // We should get back a sequence + Asn1Sequence returnedSequence = (Asn1Sequence) decoder.decode(returnedValue); + + if (returnedSequence == null) + throw new System.IO.IOException("Decoding error"); + + // How many sequences in this list + int numberOfSequences = returnedSequence.size(); + returnedFilter = new System.String[numberOfSequences][]; + + // Parse each returned sequence object + for (int classNumber = 0; classNumber < numberOfSequences; classNumber++) + { + + // Get the next Asn1Sequence + Asn1Sequence asn1_innerSequence = (Asn1Sequence) returnedSequence.get_Renamed(classNumber); + if (asn1_innerSequence == null) + throw new System.IO.IOException("Decoding error"); + + // Get the asn1 encoded classname + Asn1OctetString asn1_className = (Asn1OctetString) asn1_innerSequence.get_Renamed(0); + if (asn1_className == null) + return ; + + // Get the attribute List + Asn1Sequence asn1_attributeList = (Asn1Sequence) asn1_innerSequence.get_Renamed(1); + if (asn1_attributeList == null) + throw new System.IO.IOException("Decoding error"); + + int numberOfAttributes = asn1_attributeList.size(); + returnedFilter[classNumber] = new System.String[numberOfAttributes + 1]; + + // Get the classname + returnedFilter[classNumber][0] = asn1_className.stringValue(); + if ((System.Object) returnedFilter[classNumber][0] == null) + throw new System.IO.IOException("Decoding error"); + + for (int attributeNumber = 0; attributeNumber < numberOfAttributes; attributeNumber++) + { + + // Get the asn1 encoded attribute name + Asn1OctetString asn1_attributeName = (Asn1OctetString) asn1_attributeList.get_Renamed(attributeNumber); + if (asn1_attributeName == null) + throw new System.IO.IOException("Decoding error"); + + // Get attributename string + returnedFilter[classNumber][attributeNumber + 1] = asn1_attributeName.stringValue(); + if ((System.Object) returnedFilter[classNumber][attributeNumber + 1] == null) + throw new System.IO.IOException("Decoding error"); + } + } + } + } + } +} diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/ListReplicasRequest.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/ListReplicasRequest.cs new file mode 100755 index 00000000000..06f5a4735ac --- /dev/null +++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/ListReplicasRequest.cs @@ -0,0 +1,91 @@ +/****************************************************************************** +* 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.Extensions.ListReplicasRequest.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; +using Novell.Directory.Ldap.Utilclass; + +namespace Novell.Directory.Ldap.Extensions +{ + + /// <summary> + /// Lists all the replicas that reside on the the specified directory server. + /// + /// <p>To list replicas, you must create an instance + /// of this class and then call the extendedOperation method with this + /// object as the required LdapExtendedOperation parameter.</p> + /// + /// <p>The listReplicaRequest extension uses the following OID:<br> + /// 2.16.840.1.113719.1.27.100.19</p> + /// + /// <p>The requestValue has the following format:<br> + /// + /// requestValue ::=<br> + /// serverName LdapDN</p> + /// </summary> + public class ListReplicasRequest:LdapExtendedOperation + { + + /// <summary> Constructs an extended operation object for listing replicas. + /// + /// </summary> + /// <param name="serverName">The server which contains replicas. + /// + /// </param> + /// <exception cref=""> LdapException A general exception which includes an error + /// message and an Ldap error code. + /// </exception> + public ListReplicasRequest(System.String serverName):base(ReplicationConstants.LIST_REPLICAS_REQ, null) + { + + try + { + + if ((System.Object) serverName == null) + throw new System.ArgumentException(ExceptionMessages.PARAM_ERROR); + + System.IO.MemoryStream encodedData = new System.IO.MemoryStream(); + LBEREncoder encoder = new LBEREncoder(); + + Asn1OctetString asn1_serverName = new Asn1OctetString(serverName); + + asn1_serverName.encode(encoder, encodedData); + + setValue(SupportClass.ToSByteArray(encodedData.ToArray())); + } + catch (System.IO.IOException ioe) + { + throw new LdapException(ExceptionMessages.ENCODING_ERROR, LdapException.ENCODING_ERROR, (System.String) null); + } + } + } +} diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/ListReplicasResponse.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/ListReplicasResponse.cs new file mode 100755 index 00000000000..c391918d7d2 --- /dev/null +++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/ListReplicasResponse.cs @@ -0,0 +1,125 @@ +/****************************************************************************** +* 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.Extensions.ListReplicasResponse.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; +using Novell.Directory.Ldap.Utilclass; +using Novell.Directory.Ldap.Rfc2251; + +namespace Novell.Directory.Ldap.Extensions +{ + + /// <summary> Retrieves the list of replicas from the specified server. + /// + /// <p>An object in this class is generated from an ExtendedResponse object + /// using the ExtendedResponseFactory class.</p> + /// + /// <p>The listReplicaResponse extension uses the following OID:<br> + /// 2.16.840.1.113719.1.27.20</p> + /// + /// </summary> + public class ListReplicasResponse:LdapExtendedResponse + { + /// <summary> Returns a list of distinguished names for the replicas on the server. + /// + /// </summary> + /// <returns> String value specifying the identity returned by the server + /// </returns> + virtual public System.String[] ReplicaList + { + get + { + return replicaList; + } + + } + + // Identity returned by the server + private System.String[] replicaList; + + /// <summary> Constructs an object from the responseValue which contains the list + /// of replicas. + /// + /// <p>The constructor parses the responseValue which has the following + /// format:<br> + /// responseValue ::=<br> + /// replicaList + /// SEQUENCE OF OCTET STRINGS + /// + /// </summary> + /// <exception cref=""> IOException The responseValue could not be decoded. + /// </exception> + public ListReplicasResponse(RfcLdapMessage rfcMessage):base(rfcMessage) + { + + if (ResultCode != LdapException.SUCCESS) + { + replicaList = new System.String[0]; + } + else + { + // parse the contents of the reply + sbyte[] returnedValue = this.Value; + if (returnedValue == null) + throw new System.IO.IOException("No returned value"); + + // Create a decoder object + LBERDecoder decoder = new LBERDecoder(); + if (decoder == null) + throw new System.IO.IOException("Decoding error"); + + // We should get back a sequence + Asn1Sequence returnedSequence = (Asn1Sequence) decoder.decode(returnedValue); + if (returnedSequence == null) + throw new System.IO.IOException("Decoding error"); + + // How many replicas were returned + int len = returnedSequence.size(); + replicaList = new System.String[len]; + + // Copy each one into our String array + for (int i = 0; i < len; i++) + { + // Get the next Asn1Octet String in the sequence + Asn1OctetString asn1_nextReplica = (Asn1OctetString) returnedSequence.get_Renamed(i); + if (asn1_nextReplica == null) + throw new System.IO.IOException("Decoding error"); + + // Convert to a string + replicaList[i] = asn1_nextReplica.stringValue(); + if ((System.Object) replicaList[i] == null) + throw new System.IO.IOException("Decoding error"); + } + } + } + } +} diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/MergePartitionsRequest.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/MergePartitionsRequest.cs new file mode 100755 index 00000000000..5f2a5ab7aa3 --- /dev/null +++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/MergePartitionsRequest.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.Extensions.MergePartitionsRequest.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; +using Novell.Directory.Ldap.Utilclass; + +namespace Novell.Directory.Ldap.Extensions +{ + + /// <summary> + /// Merges a child partition with its parent partition. + /// + /// <p>To merge a child partition with its parent, you must create an + /// instance of this class and then call the extendedOperation method + /// with this object as the required LdapExtendedOperation parameter.</p> + /// + /// <p>The mergePartitionsRequest extension uses the following OID:<br> + /// 2.16.840.1.113719.1.27.100.5</p> + /// + /// <p>The requestValue has the following format:<br> + /// + /// requestValue ::=<br> + /// flags INTEGER<br> + /// dn LdapDN</p> + /// </summary> + public class MergePartitionsRequest:LdapExtendedOperation + { + + /// <summary> Constructs an extended operation object for merging partitions. + /// + /// </summary> + /// <param name="dn"> The distinguished name of the child partition's root. + /// <br><br> + /// </param> + /// <param name="flags"> Determines whether all servers in the replica ring must + /// be up before proceeding. When set to zero, the status of + /// the servers is not checked. When set to + /// Ldap_ENSURE_SERVERS_UP, all servers must be up for the + /// operation to proceed. + /// + /// </param> + /// <exception cref=""> LdapException A general exception which includes an error + /// message and an Ldap error code. + /// </exception> + + public MergePartitionsRequest(System.String dn, int flags):base(ReplicationConstants.MERGE_NAMING_CONTEXT_REQ, null) + { + + try + { + + if ((System.Object) dn == null) + throw new System.ArgumentException(ExceptionMessages.PARAM_ERROR); + + System.IO.MemoryStream encodedData = new System.IO.MemoryStream(); + LBEREncoder encoder = new LBEREncoder(); + + Asn1Integer asn1_flags = new Asn1Integer(flags); + Asn1OctetString asn1_dn = new Asn1OctetString(dn); + + asn1_flags.encode(encoder, encodedData); + asn1_dn.encode(encoder, encodedData); + + setValue(SupportClass.ToSByteArray(encodedData.ToArray())); + } + catch (System.IO.IOException ioe) + { + throw new LdapException(ExceptionMessages.ENCODING_ERROR, LdapException.ENCODING_ERROR, (System.String) null); + } + } + } +} diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/NamingContextConstants.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/NamingContextConstants.cs new file mode 100755 index 00000000000..47c9c09d13e --- /dev/null +++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/NamingContextConstants.cs @@ -0,0 +1,367 @@ +/****************************************************************************** +* 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.Extensions.NamingContextConstants.cs +// +// Author: +// Sunil Kumar (Sunilk@novell.com) +// +// (C) 2003 Novell, Inc (http://www.novell.com) +// + +using System; + +namespace Novell.Directory.Ldap.Extensions +{ + + /* + * public class NamingContextConstants + */ + + /// <summary> Contains a collection of constants used by the Novell Ldap extensions.</summary> + public class NamingContextConstants + { + + /// <summary> A constant for the createNamingContextRequest OID.</summary> + public const System.String CREATE_NAMING_CONTEXT_REQ = "2.16.840.1.113719.1.27.100.3"; + + /// <summary> A constant for the createNamingContextResponse OID.</summary> + public const System.String CREATE_NAMING_CONTEXT_RES = "2.16.840.1.113719.1.27.100.4"; + + /// <summary> A constant for the mergeNamingContextRequest OID.</summary> + public const System.String MERGE_NAMING_CONTEXT_REQ = "2.16.840.1.113719.1.27.100.5"; + + /// <summary> A constant for the mergeNamingContextResponse OID.</summary> + public const System.String MERGE_NAMING_CONTEXT_RES = "2.16.840.1.113719.1.27.100.6"; + + /// <summary> A constant for the addReplicaRequest OID.</summary> + public const System.String ADD_REPLICA_REQ = "2.16.840.1.113719.1.27.100.7"; + + /// <summary> A constant for the addReplicaResponse OID.</summary> + public const System.String ADD_REPLICA_RES = "2.16.840.1.113719.1.27.100.8"; + + /// <summary> A constant for the refreshServerRequest OID.</summary> + public const System.String REFRESH_SERVER_REQ = "2.16.840.1.113719.1.27.100.9"; + + /// <summary> A constant for the refreshServerResponse OID.</summary> + public const System.String REFRESH_SERVER_RES = "2.16.840.1.113719.1.27.100.10"; + + /// <summary> A constant for the removeReplicaRequest OID.</summary> + public const System.String DELETE_REPLICA_REQ = "2.16.840.1.113719.1.27.100.11"; + + /// <summary> A constant for the removeReplicaResponse OID.</summary> + public const System.String DELETE_REPLICA_RES = "2.16.840.1.113719.1.27.100.12"; + + /// <summary> A constant for the namingContextEntryCountRequest OID.</summary> + public const System.String NAMING_CONTEXT_COUNT_REQ = "2.16.840.1.113719.1.27.100.13"; + + /// <summary> A constant for the namingContextEntryCountResponse OID.</summary> + public const System.String NAMING_CONTEXT_COUNT_RES = "2.16.840.1.113719.1.27.100.14"; + + /// <summary> A constant for the changeReplicaTypeRequest OID.</summary> + public const System.String CHANGE_REPLICA_TYPE_REQ = "2.16.840.1.113719.1.27.100.15"; + + /// <summary> A constant for the changeReplicaTypeResponse OID.</summary> + public const System.String CHANGE_REPLICA_TYPE_RES = "2.16.840.1.113719.1.27.100.16"; + + /// <summary> A constant for the getReplicaInfoRequest OID.</summary> + public const System.String GET_REPLICA_INFO_REQ = "2.16.840.1.113719.1.27.100.17"; + + /// <summary> A constant for the getReplicaInfoResponse OID.</summary> + public const System.String GET_REPLICA_INFO_RES = "2.16.840.1.113719.1.27.100.18"; + + /// <summary> A constant for the listReplicaRequest OID.</summary> + public const System.String LIST_REPLICAS_REQ = "2.16.840.1.113719.1.27.100.19"; + + /// <summary> A constant for the listReplicaResponse OID.</summary> + public const System.String LIST_REPLICAS_RES = "2.16.840.1.113719.1.27.100.20"; + + /// <summary> A constant for the receiveAllUpdatesRequest OID.</summary> + public const System.String RECEIVE_ALL_UPDATES_REQ = "2.16.840.1.113719.1.27.100.21"; + + /// <summary> A constant for the receiveAllUpdatesResponse OID.</summary> + public const System.String RECEIVE_ALL_UPDATES_RES = "2.16.840.1.113719.1.27.100.22"; + + /// <summary> A constant for the sendAllUpdatesRequest OID.</summary> + public const System.String SEND_ALL_UPDATES_REQ = "2.16.840.1.113719.1.27.100.23"; + + /// <summary> A constant for the sendAllUpdatesResponse OID.</summary> + public const System.String SEND_ALL_UPDATES_RES = "2.16.840.1.113719.1.27.100.24"; + + /// <summary> A constant for the requestNamingContextSyncRequest OID.</summary> + public const System.String NAMING_CONTEXT_SYNC_REQ = "2.16.840.1.113719.1.27.100.25"; + + /// <summary> A constant for the requestNamingContextSyncResponse OID.</summary> + public const System.String NAMING_CONTEXT_SYNC_RES = "2.16.840.1.113719.1.27.100.26"; + + /// <summary> A constant for the requestSchemaSyncRequest OID.</summary> + public const System.String SCHEMA_SYNC_REQ = "2.16.840.1.113719.1.27.100.27"; + + /// <summary> A constant for the requestSchemaSyncResponse OID.</summary> + public const System.String SCHEMA_SYNC_RES = "2.16.840.1.113719.1.27.100.28"; + + /// <summary> A constant for the abortNamingContextOperationRequest OID.</summary> + public const System.String ABORT_NAMING_CONTEXT_OP_REQ = "2.16.840.1.113719.1.27.100.29"; + + /// <summary> A constant for the abortNamingContextOperationResponse OID.</summary> + public const System.String ABORT_NAMING_CONTEXT_OP_RES = "2.16.840.1.113719.1.27.100.30"; + + /// <summary> A constant for the getContextIdentityNameRequest OID.</summary> + public const System.String GET_IDENTITY_NAME_REQ = "2.16.840.1.113719.1.27.100.31"; + + /// <summary> A constant for the getContextIdentityNameResponse OID.</summary> + public const System.String GET_IDENTITY_NAME_RES = "2.16.840.1.113719.1.27.100.32"; + + /// <summary> A constant for the getEffectivePrivilegesRequest OID.</summary> + public const System.String GET_EFFECTIVE_PRIVILEGES_REQ = "2.16.840.1.113719.1.27.100.33"; + + /// <summary> A constant for the getEffectivePrivilegesResponse OID.</summary> + public const System.String GET_EFFECTIVE_PRIVILEGES_RES = "2.16.840.1.113719.1.27.100.34"; + + /// <summary> A constant for the setReplicationFilterRequest OID.</summary> + public const System.String SET_REPLICATION_FILTER_REQ = "2.16.840.1.113719.1.27.100.35"; + + /// <summary> A constant for the setReplicationFilterResponse OID.</summary> + public const System.String SET_REPLICATION_FILTER_RES = "2.16.840.1.113719.1.27.100.36"; + + /// <summary> A constant for the getReplicationFilterRequest OID.</summary> + public const System.String GET_REPLICATION_FILTER_REQ = "2.16.840.1.113719.1.27.100.37"; + + /// <summary> A constant for the getReplicationFilterResponse OID.</summary> + public const System.String GET_REPLICATION_FILTER_RES = "2.16.840.1.113719.1.27.100.38"; + + /// <summary> A constant for the createOrphanNamingContextRequest OID.</summary> + public const System.String CREATE_ORPHAN_NAMING_CONTEXT_REQ = "2.16.840.1.113719.1.27.100.39"; + + /// <summary> A constant for the createOrphanNamingContextResponse OID.</summary> + public const System.String CREATE_ORPHAN_NAMING_CONTEXT_RES = "2.16.840.1.113719.1.27.100.40"; + + /// <summary> A constant for the removeOrphanNamingContextRequest OID.</summary> + public const System.String REMOVE_ORPHAN_NAMING_CONTEXT_REQ = "2.16.840.1.113719.1.27.100.41"; + + /// <summary> A constant for the removeOrphanNamingContextResponse OID.</summary> + public const System.String REMOVE_ORPHAN_NAMING_CONTEXT_RES = "2.16.840.1.113719.1.27.100.42"; + + /// <summary> A constant for the triggerBackLinkerRequest OID.</summary> + public const System.String TRIGGER_BKLINKER_REQ = "2.16.840.1.113719.1.27.100.43"; + + /// <summary> A constant for the triggerBackLinkerResponse OID.</summary> + public const System.String TRIGGER_BKLINKER_RES = "2.16.840.1.113719.1.27.100.44"; + + /// <summary> A constant for the triggerJanitorRequest OID.</summary> + public const System.String TRIGGER_JANITOR_REQ = "2.16.840.1.113719.1.27.100.47"; + + /// <summary> A constant for the triggerJanitorResponse OID.</summary> + public const System.String TRIGGER_JANITOR_RES = "2.16.840.1.113719.1.27.100.48"; + + /// <summary> A constant for the triggerLimberRequest OID.</summary> + public const System.String TRIGGER_LIMBER_REQ = "2.16.840.1.113719.1.27.100.49"; + + /// <summary> A constant for the triggerLimberResponse OID.</summary> + public const System.String TRIGGER_LIMBER_RES = "2.16.840.1.113719.1.27.100.50"; + + /// <summary> A constant for the triggerSkulkerRequest OID.</summary> + public const System.String TRIGGER_SKULKER_REQ = "2.16.840.1.113719.1.27.100.51"; + + /// <summary> A constant for the triggerSkulkerResponse OID.</summary> + public const System.String TRIGGER_SKULKER_RES = "2.16.840.1.113719.1.27.100.52"; + + /// <summary> A constant for the triggerSchemaSyncRequest OID.</summary> + public const System.String TRIGGER_SCHEMA_SYNC_REQ = "2.16.840.1.113719.1.27.100.53"; + + /// <summary> A constant for the triggerSchemaSyncResponse OID.</summary> + public const System.String TRIGGER_SCHEMA_SYNC_RES = "2.16.840.1.113719.1.27.100.54"; + + /// <summary> A constant for the triggerPartitionPurgeRequest OID.</summary> + public const System.String TRIGGER_PART_PURGE_REQ = "2.16.840.1.113719.1.27.100.55"; + + /// <summary> A constant for the triggerPartitionPurgeResponse OID.</summary> + public const System.String TRIGGER_PART_PURGE_RES = "2.16.840.1.113719.1.27.100.56"; + + + /// <summary> A constant that specifies that all servers in a replica ring must be + /// running for a naming context operation to proceed. + /// </summary> + public const int Ldap_ENSURE_SERVERS_UP = 1; + + + /// <summary> Identifies this replica as the master replica of the naming context. + /// + /// <p>On this type of replica, entries can be modified, and naming context + /// operations can be performed.</p> + /// </summary> + public const int Ldap_RT_MASTER = 0; + + /// <summary> Identifies this replica as a secondary replica of the naming context. + /// + /// <p>On this type of replica, read and write operations can be performed, + /// and entries can be modified.</p> + /// </summary> + public const int Ldap_RT_SECONDARY = 1; + + /// <summary> Identifies this replica as a read-only replica of the naming context. + /// + /// <p>Only Novell eDirectory synchronization processes can modifie + /// entries on this replica.</p> + /// </summary> + public const int Ldap_RT_READONLY = 2; + + /// <summary> Identifies this replica as a subordinate reference replica of the + /// naming context. + /// + /// <p>Novell eDirectory automatically adds these replicas to a server + /// when the server does not contain replicas of all child naming contexts. + /// Only eDirectory can modify information on these types of replicas. </p> + /// </summary> + public const int Ldap_RT_SUBREF = 3; + + /// <summary> Identifies this replica as a read/write replica of the naming context, + /// but the replica contains sparse data. + /// + /// <p>The replica has been configured to contain only specified object types + /// and attributes. On this type of replica, only the attributes and objects + /// contained in the sparse data can be modified.</p> + /// </summary> + public const int Ldap_RT_SPARSE_WRITE = 4; + + /// <summary> Identifies this replica as a read-only replica of the naming context, + /// but the replica contains sparse data. + /// + /// <p>The replica has been configured to contain only specified object types + /// and attributes. On this type of replica, only Novell eDirectory + /// synchronization processes can modify the sparse data.</p> + /// </summary> + public const int Ldap_RT_SPARSE_READ = 5; + + //Replica States + + /// <summary> Indicates that the replica is fully functioning and capable of responding + /// to requests. + /// </summary> + public const int Ldap_RS_ON = 0; + + /// <summary> Indicates that a new replica has been added but has not received a full + /// download of information from the replica ring. + /// </summary> + public const int Ldap_RS_NEW_REPLICA = 1; + + /// <summary> Indicates that the replica is being deleted and that the request has + /// been received. + /// </summary> + public const int Ldap_RS_DYING_REPLICA = 2; + + /// <summary> Indicates that the replica is locked. The move operation uses this state + /// to lock the parent naming context of the child naming context that is moving. + /// </summary> + public const int Ldap_RS_LOCKED = 3; + + /// <summary> Indicates that a new replica has finished receiving its download from the + /// master replica and is now receiving synchronization updates from other + /// replicas. + /// </summary> + public const int Ldap_RS_TRANSITION_ON = 6; + + + /// <summary> Indicates that the dying replica needs to synchronize with another replica + /// before being converted either to an external reference, if a root replica, + /// or to a subordinate reference, if a non-root replica. + /// </summary> + public const int Ldap_RS_DEAD_REPLICA = 7; + + /// <summary> Indicates that the subordinate references of the new replica are being + /// added. + /// </summary> + public const int Ldap_RS_BEGIN_ADD = 8; + + /// <summary> Indicates that a naming context is receiving a new master replica. + /// + /// <p>The replica that will be the new master replica is set to this state.</p> + /// </summary> + public const int Ldap_RS_MASTER_START = 11; + + /// <summary> Indicates that a naming context has a new master replica. + /// + /// <p>When the new master is set to this state, Novell eDirectory knows + /// that the replica is now the master and changes its replica type to + /// master and the old master to read/write.</p> + /// </summary> + public const int Ldap_RS_MASTER_DONE = 12; + + /// <summary> Indicates that the naming context is going to split into two naming contexts. + /// + /// <p>In this state, other replicas of the naming context are informed of the + /// pending split.</p> + /// </summary> + public const int Ldap_RS_SS_0 = 48; // Replica splitting 0 + + /// <summary> Indicates that that the split naming context operation has started. + /// + /// <p>When the split is finished, the state will change to RS_ON.</p> + /// </summary> + public const int Ldap_RS_SS_1 = 49; // Replica splitting 1 + + /// <summary> Indicates that that two naming contexts are in the process of joining + /// into one naming context. + /// + /// <p>In this state, the replicas that are affected are informed of the join + /// operation. The master replica of the parent and child naming contexts are + /// first set to this state and then all the replicas of the parent and child. + /// New replicas are added where needed.</p> + /// </summary> + public const int Ldap_RS_JS_0 = 64; // Replica joining 0 + + /// <summary> Indicates that that two naming contexts are in the process of joining + /// into one naming context. + /// + /// <p>This state indicates that the join operation is waiting for the new + /// replicas to synchronize and move to the RS_ON state.</p> + /// </summary> + public const int Ldap_RS_JS_1 = 65; // Replica joining 1 + + /// <summary> Indicates that that two naming contexts are in the process of joining + /// into one naming context. + /// + /// <p>This state indicates that all the new replicas are in the RS_ON state + /// and that the rest of the work can be completed.</p> + /// </summary> + public const int Ldap_RS_JS_2 = 66; // Replica joining 2 + + + // Values for flags used in the replica info class structure + + /// <summary> Indicates that the replica is involved with a partition operation, + /// for example, merging a tree or moving a subtree. + /// </summary> + public const int Ldap_DS_FLAG_BUSY = 0x0001; + + /// <summary> Indicates that this naming context is on the DNS federation boundary. + /// This flag is only set on DNS trees. + /// </summary> + public const int Ldap_DS_FLAG_BOUNDARY = 0x0002; + + + public NamingContextConstants() + { + } + } +} diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/PartitionEntryCountRequest.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/PartitionEntryCountRequest.cs new file mode 100755 index 00000000000..715ed90b679 --- /dev/null +++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/PartitionEntryCountRequest.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.Extensions.PartitionEntryCountRequest.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; +using Novell.Directory.Ldap.Utilclass; + +namespace Novell.Directory.Ldap.Extensions +{ + + /// <summary> Returns a count of the number of entries (objects) in the + /// specified partition. + /// + /// <p>To obtain the count of entries, you must create an instance of this + /// class and then call the extendedOperation method with this + /// object as the required LdapExtendedOperation parameter.</p> + /// + /// <p>The returned LdapExtendedResponse object can then be converted to + /// a PartitionEntryCountResponse object. This class contains + /// methods for retrieving the returned count.</p> + /// + /// <p>The PartitionEntryCountRequest extension uses the following + /// OID:<br> + /// 2.16.840.1.113719.1.27.100.13</p> + /// + /// <p>The requestValue has the following format:<br> + /// + /// requestValue ::=<br><br> + /// dn LdapDN + /// </summary> + public class PartitionEntryCountRequest:LdapExtendedOperation + { + + /// <summary> Constructs an extended operation object for counting entries + /// in a naming context. + /// + /// </summary> + /// <param name="dn"> The distinguished name of the partition. + /// + /// </param> + /// <exception cref=""> LdapException A general exception which includes an + /// error message and an Ldap error code. + /// </exception> + + public PartitionEntryCountRequest(System.String dn):base(ReplicationConstants.NAMING_CONTEXT_COUNT_REQ, null) + { + + try + { + + if (((System.Object) dn == null)) + throw new System.ArgumentException(ExceptionMessages.PARAM_ERROR); + + System.IO.MemoryStream encodedData = new System.IO.MemoryStream(); + LBEREncoder encoder = new LBEREncoder(); + + Asn1OctetString asn1_dn = new Asn1OctetString(dn); + + asn1_dn.encode(encoder, encodedData); + + setValue(SupportClass.ToSByteArray(encodedData.ToArray())); + } + catch (System.IO.IOException ioe) + { + throw new LdapException(ExceptionMessages.ENCODING_ERROR, LdapException.ENCODING_ERROR, (System.String) null); + } + } + } +} diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/PartitionEntryCountResponse.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/PartitionEntryCountResponse.cs new file mode 100755 index 00000000000..a261685f094 --- /dev/null +++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/PartitionEntryCountResponse.cs @@ -0,0 +1,107 @@ +/****************************************************************************** +* 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.Extensions.PartitionEntryCountResponse.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; +using Novell.Directory.Ldap.Utilclass; +using Novell.Directory.Ldap.Rfc2251; +namespace Novell.Directory.Ldap.Extensions +{ + + /// <summary> Returns the number of entries in the partition. + /// + /// <p>An object in this class is generated from an ExtendedResponse object + /// using the ExtendedResponseFactory class.</p> + /// + /// <p>The PartitionEntryCountResponse extension uses the following + /// OID:<br> + /// 2.16.840.1.113719.1.27.100.14</p> + /// + /// </summary> + public class PartitionEntryCountResponse:LdapExtendedResponse + { + /// <summary> Returns the number of entries in the naming context. + /// + /// </summary> + /// <returns> The count of the number of objects returned. + /// </returns> + virtual public int Count + { + get + { + return count; + } + + } + + //The count of the objects returned by the server is saved here + private int count; + + /// <summary> Constructs an object from the responseValue which contains the + /// entry count. + /// + /// <p>The constructor parses the responseValue which has the following + /// format:<br> + /// responseValue ::=<br> + /// count   INTEGER</p> + /// + /// </summary> + /// <exception cref=""> IOException The response value could not be decoded. + /// </exception> + public PartitionEntryCountResponse(RfcLdapMessage rfcMessage):base(rfcMessage) + { + + if (ResultCode == LdapException.SUCCESS) + { + // parse the contents of the reply + sbyte[] returnedValue = this.Value; + if (returnedValue == null) + throw new System.IO.IOException("No returned value"); + + // Create a decoder object + LBERDecoder decoder = new LBERDecoder(); + if (decoder == null) + throw new System.IO.IOException("Decoding error"); + + Asn1Integer asn1_count = (Asn1Integer) decoder.decode(returnedValue); + if (asn1_count == null) + throw new System.IO.IOException("Decoding error"); + + count = asn1_count.intValue(); + } + else + { + count = - 1; + } + } + } +} diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/PartitionSyncRequest.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/PartitionSyncRequest.cs new file mode 100755 index 00000000000..7cf3e9db870 --- /dev/null +++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/PartitionSyncRequest.cs @@ -0,0 +1,104 @@ +/****************************************************************************** +* 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.Extensions.PartitionSyncRequest.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; +using Novell.Directory.Ldap.Utilclass; + +namespace Novell.Directory.Ldap.Extensions +{ + + /// <summary> + /// Synchronizes all replicas of a naming context. + /// + /// <p>The PartitionSyncRequest extension uses the following OID:<br> + /// 2.16.840.1.113719.1.27.100.25</p> + /// + /// <p>The requestValue has the following format:<br> + /// + /// requestValue ::=<br> + /// serverName LdapDN<br> + /// partitionRoot LdapDN<br> + /// delay INTEGER</p> + /// </summary> + public class PartitionSyncRequest:LdapExtendedOperation + { + + /// <summary> + /// Constructs an extended operation object for synchronizing the replicas + /// of a partition. + /// + /// </summary> + /// <param name="serverName"> The distinquished name of server containing the + /// naming context. + /// <br><br> + /// </param> + /// <param name="partitionRoot"> The distinguished name of the naming context + /// to synchronize. + /// <br><br> + /// </param> + /// <param name="delay"> The time, in seconds, to delay before the synchronization + /// should start. + /// + /// </param> + /// <exception cref=""> LdapException A general exception which includes an error message + /// and an Ldap error code. + /// </exception> + public PartitionSyncRequest(System.String serverName, System.String partitionRoot, int delay):base(ReplicationConstants.NAMING_CONTEXT_SYNC_REQ, null) + { + + try + { + + if (((System.Object) serverName == null) || ((System.Object) partitionRoot == null)) + throw new System.ArgumentException(ExceptionMessages.PARAM_ERROR); + + System.IO.MemoryStream encodedData = new System.IO.MemoryStream(); + LBEREncoder encoder = new LBEREncoder(); + + Asn1OctetString asn1_serverName = new Asn1OctetString(serverName); + Asn1OctetString asn1_partitionRoot = new Asn1OctetString(partitionRoot); + Asn1Integer asn1_delay = new Asn1Integer(delay); + + asn1_serverName.encode(encoder, encodedData); + asn1_partitionRoot.encode(encoder, encodedData); + asn1_delay.encode(encoder, encodedData); + + setValue(SupportClass.ToSByteArray(encodedData.ToArray())); + } + catch (System.IO.IOException ioe) + { + throw new LdapException(ExceptionMessages.ENCODING_ERROR, LdapException.ENCODING_ERROR, (System.String) null); + } + } + } +} diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/ReceiveAllUpdatesRequest.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/ReceiveAllUpdatesRequest.cs new file mode 100755 index 00000000000..149f9f0eb25 --- /dev/null +++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/ReceiveAllUpdatesRequest.cs @@ -0,0 +1,104 @@ +/****************************************************************************** +* 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.Extensions.ReceiveAllUpdatesRequest.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; +using Novell.Directory.Ldap.Utilclass; + +namespace Novell.Directory.Ldap.Extensions +{ + + /// <summary> Schedules a specified directory server to receive updates from another + /// directory server for a specific replica. + /// + /// <p>The receiveAllUpdatesRequest extension uses the following OID:<br> + /// 2.16.840.1.113719.1.27.100.21</p> + /// + /// <p>The requestValue has the following format:<br> + /// + /// requestValue ::=<br> + /// partitionRoot LdapDN<br> + /// toServerDN LdapDN<br> + /// fromServerDN LdapDN</p> + /// </summary> + public class ReceiveAllUpdatesRequest:LdapExtendedOperation + { + + /// <summary> + /// Constructs an extended operation object for receiving all updates from + /// another directory server for a specific replica. + /// + /// </summary> + /// <param name="partitionRoot"> The distinguished name of the replica + /// that will be updated. + /// <br><br> + /// </param> + /// <param name="toServerDN"> The distinguished name of the server holding the + /// replica to be updated. + /// <br><br> + /// </param> + /// <param name="fromServerDN"> The distinguished name of the server from which + /// updates are sent. + /// + /// </param> + /// <exception cref=""> LdapException A general exception which includes an error message + /// and an Ldap error code. + /// </exception> + public ReceiveAllUpdatesRequest(System.String partitionRoot, System.String toServerDN, System.String fromServerDN):base(ReplicationConstants.RECEIVE_ALL_UPDATES_REQ, null) + { + + try + { + + if (((System.Object) partitionRoot == null) || ((System.Object) toServerDN == null) || ((System.Object) fromServerDN == null)) + throw new System.ArgumentException(ExceptionMessages.PARAM_ERROR); + + System.IO.MemoryStream encodedData = new System.IO.MemoryStream(); + LBEREncoder encoder = new LBEREncoder(); + + Asn1OctetString asn1_partitionRoot = new Asn1OctetString(partitionRoot); + Asn1OctetString asn1_toServerDN = new Asn1OctetString(toServerDN); + Asn1OctetString asn1_fromServerDN = new Asn1OctetString(fromServerDN); + + asn1_partitionRoot.encode(encoder, encodedData); + asn1_toServerDN.encode(encoder, encodedData); + asn1_fromServerDN.encode(encoder, encodedData); + + setValue(SupportClass.ToSByteArray(encodedData.ToArray())); + } + catch (System.IO.IOException ioe) + { + throw new LdapException(ExceptionMessages.ENCODING_ERROR, LdapException.ENCODING_ERROR, (System.String) null); + } + } + } +} diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/RefreshLdapServerRequest.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/RefreshLdapServerRequest.cs new file mode 100755 index 00000000000..aaf2230eed2 --- /dev/null +++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/RefreshLdapServerRequest.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.Extensions.RefreshLdapServerRequest.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; +using Novell.Directory.Ldap.Utilclass; + +namespace Novell.Directory.Ldap.Extensions +{ + + /// <summary> + /// Reloads the Ldap server. + /// + /// <p>The refreshLdapServerRequest extension uses the following OID:<br> + /// 2.16.840.1.113719.1.27.100.9</p> + /// + /// <p>The requestValue is set to null.</p> + /// </summary> + public class RefreshLdapServerRequest:LdapExtendedOperation + { + + /// <summary> + /// Constructs an extended operation object for reloading the Ldap server. + /// + /// <p>The constructor sets the OID.</p> + /// + /// </summary> + /// <exception cref=""> LdapException A general exception which includes an error + /// message and an Ldap error code. + /// </exception> + public RefreshLdapServerRequest():base(ReplicationConstants.REFRESH_SERVER_REQ, null) + { + } + } +} diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/RemoveOrphanPartitionRequest.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/RemoveOrphanPartitionRequest.cs new file mode 100755 index 00000000000..ce6c25003d2 --- /dev/null +++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/RemoveOrphanPartitionRequest.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.Extensions.RemoveOrphanPartitionRequest.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; +using Novell.Directory.Ldap.Utilclass; + +namespace Novell.Directory.Ldap.Extensions +{ + + /// <summary> Deletes an orphan partition. + /// + /// <p>To delete an orphan partition, you must create an instance of this + /// class and then call the extendedOperation method with this + /// object as the required LdapExtendedOperation parameter.</p> + /// + /// <p>The RemoveOrphanPartitionRequest extension uses the following OID:<br> + /// 2.16.840.1.113719.1.27.100.41</p> + /// + /// <p>The requestValue has the following format:<br> + /// + /// requestValue ::=<br> + /// serverDN LdapDN<br> + /// contextName LdapDN</p> + /// </summary> + public class RemoveOrphanPartitionRequest:LdapExtendedOperation + { + + /// <summary> Constructs an extended operation object for deleting an orphan partition. + /// + /// </summary> + /// <param name="serverDN"> The distinguished name of the server + /// on which the orphan partition resides. + /// <br><br> + /// </param> + /// <param name="contextName"> The distinguished name of the orphan + /// partition to delete. + /// + /// </param> + /// <exception cref=""> LdapException A general exception which includes an error message + /// and an Ldap error code. + /// </exception> + public RemoveOrphanPartitionRequest(System.String serverDN, System.String contextName):base(ReplicationConstants.REMOVE_ORPHAN_NAMING_CONTEXT_REQ, null) + { + + try + { + + if (((System.Object) serverDN == null) || ((System.Object) contextName == null)) + throw new System.ArgumentException(ExceptionMessages.PARAM_ERROR); + + System.IO.MemoryStream encodedData = new System.IO.MemoryStream(); + LBEREncoder encoder = new LBEREncoder(); + + Asn1OctetString asn1_serverDN = new Asn1OctetString(serverDN); + Asn1OctetString asn1_contextName = new Asn1OctetString(contextName); + + asn1_serverDN.encode(encoder, encodedData); + asn1_contextName.encode(encoder, encodedData); + + setValue(SupportClass.ToSByteArray(encodedData.ToArray())); + } + catch (System.IO.IOException ioe) + { + throw new LdapException(ExceptionMessages.ENCODING_ERROR, LdapException.ENCODING_ERROR, (System.String) null); + } + } + } +} diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/RemoveReplicaRequest.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/RemoveReplicaRequest.cs new file mode 100755 index 00000000000..0282aadd8f7 --- /dev/null +++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/RemoveReplicaRequest.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.Extensions.RemoveReplicaRequest.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; +using Novell.Directory.Ldap.Utilclass; + +namespace Novell.Directory.Ldap.Extensions +{ + + /// <summary> + /// Removes a replica from the specified directory server. + /// + /// <p>To remove a replica from a particular server, you must create an instance + /// of this class and then call the extendedOperation method with this + /// object as the required LdapExtendedOperation parameter.</p> + /// + /// <p>The removeReplicaRequest extension uses the following OID:<br> + /// 2.16.840.1.113719.1.27.100.11</p> + /// + /// <p>The requestValue has the following format:<br> + /// + /// requestValue ::=<br> + /// flags INTEGER<br> + /// serverName LdapDN<br> + /// dn LdapDN</p> + /// </summary> + public class RemoveReplicaRequest:LdapExtendedOperation + { + + /// <summary> Constructs an extended operation object for removing a replica. + /// + /// </summary> + /// <param name="dn"> The distinguished name of the replica's + /// partition root. + /// <br><br> + /// </param> + /// <param name="serverDN"> The distinguished name of server from which the replica + /// will be removed. + /// <br><br> + /// </param> + /// <param name="flags"> Determines whether all servers in the replica ring must + /// be up before proceeding. When set to zero, the status of the + /// servers is not checked. When set to Ldap_ENSURE_SERVERS_UP, + /// all servers must be up for the operation to proceed. + /// + /// </param> + /// <exception cref=""> LdapException A general exception which includes an error message + /// and an Ldap error code. + /// </exception> + public RemoveReplicaRequest(System.String dn, System.String serverDN, int flags):base(ReplicationConstants.DELETE_REPLICA_REQ, null) + { + + try + { + + if (((System.Object) dn == null) || ((System.Object) serverDN == null)) + throw new System.ArgumentException(ExceptionMessages.PARAM_ERROR); + + System.IO.MemoryStream encodedData = new System.IO.MemoryStream(); + LBEREncoder encoder = new LBEREncoder(); + + Asn1Integer asn1_flags = new Asn1Integer(flags); + Asn1OctetString asn1_serverDN = new Asn1OctetString(serverDN); + Asn1OctetString asn1_dn = new Asn1OctetString(dn); + + asn1_flags.encode(encoder, encodedData); + asn1_serverDN.encode(encoder, encodedData); + asn1_dn.encode(encoder, encodedData); + + setValue(SupportClass.ToSByteArray(encodedData.ToArray())); + } + catch (System.IO.IOException ioe) + { + throw new LdapException(ExceptionMessages.ENCODING_ERROR, LdapException.ENCODING_ERROR, (System.String) null); + } + } + } +} diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/ReplicationConstants.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/ReplicationConstants.cs new file mode 100755 index 00000000000..72e06d9bb84 --- /dev/null +++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/ReplicationConstants.cs @@ -0,0 +1,369 @@ +/****************************************************************************** +* 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.Extensions.ReplicationConstants.cs +// +// Author: +// Sunil Kumar (Sunilk@novell.com) +// +// (C) 2003 Novell, Inc (http://www.novell.com) +// + +using System; + +namespace Novell.Directory.Ldap.Extensions +{ + + /* + * public class ReplicationConstants + */ + + /// <summary> Contains a collection of constants used by the replication management + /// in Novell Ldap extensions. + /// </summary> + public class ReplicationConstants + { + + /// <summary> A constant for the SplitPartitionRequest OID.</summary> + public const System.String CREATE_NAMING_CONTEXT_REQ = "2.16.840.1.113719.1.27.100.3"; + + /// <summary> A constant for the SplitPartitionResponse OID.</summary> + public const System.String CREATE_NAMING_CONTEXT_RES = "2.16.840.1.113719.1.27.100.4"; + + /// <summary> A constant for the mergePartitionRequest OID.</summary> + public const System.String MERGE_NAMING_CONTEXT_REQ = "2.16.840.1.113719.1.27.100.5"; + + /// <summary> A constant for the mergePartitionResponse OID.</summary> + public const System.String MERGE_NAMING_CONTEXT_RES = "2.16.840.1.113719.1.27.100.6"; + + /// <summary> A constant for the addReplicaRequest OID.</summary> + public const System.String ADD_REPLICA_REQ = "2.16.840.1.113719.1.27.100.7"; + + /// <summary> A constant for the addReplicaResponse OID.</summary> + public const System.String ADD_REPLICA_RES = "2.16.840.1.113719.1.27.100.8"; + + /// <summary> A constant for the refreshServerRequest OID.</summary> + public const System.String REFRESH_SERVER_REQ = "2.16.840.1.113719.1.27.100.9"; + + /// <summary> A constant for the refreshServerResponse OID.</summary> + public const System.String REFRESH_SERVER_RES = "2.16.840.1.113719.1.27.100.10"; + + /// <summary> A constant for the removeReplicaRequest OID.</summary> + public const System.String DELETE_REPLICA_REQ = "2.16.840.1.113719.1.27.100.11"; + + /// <summary> A constant for the removeReplicaResponse OID.</summary> + public const System.String DELETE_REPLICA_RES = "2.16.840.1.113719.1.27.100.12"; + + /// <summary> A constant for the partitionEntryCountRequest OID.</summary> + public const System.String NAMING_CONTEXT_COUNT_REQ = "2.16.840.1.113719.1.27.100.13"; + + /// <summary> A constant for the partitionEntryCountResponse OID.</summary> + public const System.String NAMING_CONTEXT_COUNT_RES = "2.16.840.1.113719.1.27.100.14"; + + /// <summary> A constant for the changeReplicaTypeRequest OID.</summary> + public const System.String CHANGE_REPLICA_TYPE_REQ = "2.16.840.1.113719.1.27.100.15"; + + /// <summary> A constant for the changeReplicaTypeResponse OID.</summary> + public const System.String CHANGE_REPLICA_TYPE_RES = "2.16.840.1.113719.1.27.100.16"; + + /// <summary> A constant for the getReplicaInfoRequest OID.</summary> + public const System.String GET_REPLICA_INFO_REQ = "2.16.840.1.113719.1.27.100.17"; + + /// <summary> A constant for the getReplicaInfoResponse OID.</summary> + public const System.String GET_REPLICA_INFO_RES = "2.16.840.1.113719.1.27.100.18"; + + /// <summary> A constant for the listReplicaRequest OID.</summary> + public const System.String LIST_REPLICAS_REQ = "2.16.840.1.113719.1.27.100.19"; + + /// <summary> A constant for the listReplicaResponse OID.</summary> + public const System.String LIST_REPLICAS_RES = "2.16.840.1.113719.1.27.100.20"; + + /// <summary> A constant for the receiveAllUpdatesRequest OID.</summary> + public const System.String RECEIVE_ALL_UPDATES_REQ = "2.16.840.1.113719.1.27.100.21"; + + /// <summary> A constant for the receiveAllUpdatesResponse OID.</summary> + public const System.String RECEIVE_ALL_UPDATES_RES = "2.16.840.1.113719.1.27.100.22"; + + /// <summary> A constant for the sendAllUpdatesRequest OID.</summary> + public const System.String SEND_ALL_UPDATES_REQ = "2.16.840.1.113719.1.27.100.23"; + + /// <summary> A constant for the sendAllUpdatesResponse OID.</summary> + public const System.String SEND_ALL_UPDATES_RES = "2.16.840.1.113719.1.27.100.24"; + + /// <summary> A constant for the requestPartitionSyncRequest OID.</summary> + public const System.String NAMING_CONTEXT_SYNC_REQ = "2.16.840.1.113719.1.27.100.25"; + + /// <summary> A constant for the requestPartitionSyncResponse OID.</summary> + public const System.String NAMING_CONTEXT_SYNC_RES = "2.16.840.1.113719.1.27.100.26"; + + /// <summary> A constant for the requestSchemaSyncRequest OID.</summary> + public const System.String SCHEMA_SYNC_REQ = "2.16.840.1.113719.1.27.100.27"; + + /// <summary> A constant for the requestSchemaSyncResponse OID.</summary> + public const System.String SCHEMA_SYNC_RES = "2.16.840.1.113719.1.27.100.28"; + + /// <summary> A constant for the abortPartitionOperationRequest OID.</summary> + public const System.String ABORT_NAMING_CONTEXT_OP_REQ = "2.16.840.1.113719.1.27.100.29"; + + /// <summary> A constant for the abortPartitionOperationResponse OID.</summary> + public const System.String ABORT_NAMING_CONTEXT_OP_RES = "2.16.840.1.113719.1.27.100.30"; + + /// <summary> A constant for the getContextIdentityNameRequest OID.</summary> + public const System.String GET_IDENTITY_NAME_REQ = "2.16.840.1.113719.1.27.100.31"; + + /// <summary> A constant for the getContextIdentityNameResponse OID.</summary> + public const System.String GET_IDENTITY_NAME_RES = "2.16.840.1.113719.1.27.100.32"; + + /// <summary> A constant for the getEffectivePrivilegesRequest OID.</summary> + public const System.String GET_EFFECTIVE_PRIVILEGES_REQ = "2.16.840.1.113719.1.27.100.33"; + + /// <summary> A constant for the getEffectivePrivilegesResponse OID.</summary> + public const System.String GET_EFFECTIVE_PRIVILEGES_RES = "2.16.840.1.113719.1.27.100.34"; + + /// <summary> A constant for the setReplicationFilterRequest OID.</summary> + public const System.String SET_REPLICATION_FILTER_REQ = "2.16.840.1.113719.1.27.100.35"; + + /// <summary> A constant for the setReplicationFilterResponse OID.</summary> + public const System.String SET_REPLICATION_FILTER_RES = "2.16.840.1.113719.1.27.100.36"; + + /// <summary> A constant for the getReplicationFilterRequest OID.</summary> + public const System.String GET_REPLICATION_FILTER_REQ = "2.16.840.1.113719.1.27.100.37"; + + /// <summary> A constant for the getReplicationFilterResponse OID.</summary> + public const System.String GET_REPLICATION_FILTER_RES = "2.16.840.1.113719.1.27.100.38"; + + /// <summary> A constant for the splitOrphanPartitionRequest OID.</summary> + public const System.String CREATE_ORPHAN_NAMING_CONTEXT_REQ = "2.16.840.1.113719.1.27.100.39"; + + /// <summary> A constant for the splitOrphanPartitionResponse OID.</summary> + public const System.String CREATE_ORPHAN_NAMING_CONTEXT_RES = "2.16.840.1.113719.1.27.100.40"; + + /// <summary> A constant for the removeOrphanPartitionRequest OID.</summary> + public const System.String REMOVE_ORPHAN_NAMING_CONTEXT_REQ = "2.16.840.1.113719.1.27.100.41"; + + /// <summary> A constant for the removeOrphanPartitionResponse OID.</summary> + public const System.String REMOVE_ORPHAN_NAMING_CONTEXT_RES = "2.16.840.1.113719.1.27.100.42"; + + /// <summary> A constant for the triggerBackLinkerRequest OID.</summary> + public const System.String TRIGGER_BKLINKER_REQ = "2.16.840.1.113719.1.27.100.43"; + + /// <summary> A constant for the triggerBackLinkerResponse OID.</summary> + public const System.String TRIGGER_BKLINKER_RES = "2.16.840.1.113719.1.27.100.44"; + + /// <summary> A constant for the triggerJanitorRequest OID.</summary> + public const System.String TRIGGER_JANITOR_REQ = "2.16.840.1.113719.1.27.100.47"; + + /// <summary> A constant for the triggerJanitorResponse OID.</summary> + public const System.String TRIGGER_JANITOR_RES = "2.16.840.1.113719.1.27.100.48"; + + /// <summary> A constant for the triggerLimberRequest OID.</summary> + public const System.String TRIGGER_LIMBER_REQ = "2.16.840.1.113719.1.27.100.49"; + + /// <summary> A constant for the triggerLimberResponse OID.</summary> + public const System.String TRIGGER_LIMBER_RES = "2.16.840.1.113719.1.27.100.50"; + + /// <summary> A constant for the triggerSkulkerRequest OID.</summary> + public const System.String TRIGGER_SKULKER_REQ = "2.16.840.1.113719.1.27.100.51"; + + /// <summary> A constant for the triggerSkulkerResponse OID.</summary> + public const System.String TRIGGER_SKULKER_RES = "2.16.840.1.113719.1.27.100.52"; + + /// <summary> A constant for the triggerSchemaSyncRequest OID.</summary> + public const System.String TRIGGER_SCHEMA_SYNC_REQ = "2.16.840.1.113719.1.27.100.53"; + + /// <summary> A constant for the triggerSchemaSyncResponse OID.</summary> + public const System.String TRIGGER_SCHEMA_SYNC_RES = "2.16.840.1.113719.1.27.100.54"; + + /// <summary> A constant for the triggerPartitionPurgeRequest OID.</summary> + public const System.String TRIGGER_PART_PURGE_REQ = "2.16.840.1.113719.1.27.100.55"; + + /// <summary> A constant for the triggerPartitionPurgeResponse OID.</summary> + public const System.String TRIGGER_PART_PURGE_RES = "2.16.840.1.113719.1.27.100.56"; + + + /// <summary> A constant that specifies that all servers in a replica ring must be + /// running for a partition operation to proceed. + /// </summary> + public const int Ldap_ENSURE_SERVERS_UP = 1; + + + /// <summary> Identifies this replica as the master replica of the partition. + /// + /// <p>On this type of replica, entries can be modified, and partition + /// operations can be performed.</p> + /// </summary> + public const int Ldap_RT_MASTER = 0; + + /// <summary> Identifies this replica as a secondary replica of the partition. + /// + /// <p>On this type of replica, read and write operations can be performed, + /// and entries can be modified.</p> + /// </summary> + public const int Ldap_RT_SECONDARY = 1; + + /// <summary> Identifies this replica as a read-only replica of the partition. + /// + /// <p>Only Novell eDirectory synchronization processes can modified + /// entries on this replica.</p> + /// </summary> + public const int Ldap_RT_READONLY = 2; + + /// <summary> Identifies this replica as a subordinate reference replica of the + /// partition. + /// + /// <p>NOvell eDirectory automatically adds these replicas to a server + /// when the server does not contain replicas of all child partitions. + /// Only eDirectory can modify information on these types of replicas.</p> + /// </summary> + public const int Ldap_RT_SUBREF = 3; + + /// <summary> Identifies this replica as a read/write replica of the partition, + /// but the replica contains sparse data. + /// + /// <p>The replica has been configured to contain only specified object types + /// and attributes. On this type of replica, only the attributes and objects + /// contained in the sparse data can be modified.</p> + /// </summary> + public const int Ldap_RT_SPARSE_WRITE = 4; + + /// <summary> Identifies this replica as a read-only replica of the partition, + /// but the replica contains sparse data. + /// + /// <p>The replica has been configured to contain only specified object types + /// and attributes. On this type of replica, only Novell eDirectory + /// synchronization processes can modify the sparse data.</p> + /// </summary> + public const int Ldap_RT_SPARSE_READ = 5; + + //Replica States + + /// <summary> Indicates that the replica is fully functioning and capable of responding + /// to requests. + /// </summary> + public const int Ldap_RS_ON = 0; + + /// <summary> Indicates that a new replica has been added but has not received a full + /// download of information from the replica ring. + /// </summary> + public const int Ldap_RS_NEW_REPLICA = 1; + + /// <summary> Indicates that the replica is being deleted and that the request has + /// been received. + /// </summary> + public const int Ldap_RS_DYING_REPLICA = 2; + + /// <summary> Indicates that the replica is locked. The move operation uses this state + /// to lock the parent partition of the child partition that is moving. + /// </summary> + public const int Ldap_RS_LOCKED = 3; + + /// <summary> Indicates that a new replica has finished receiving its download from the + /// master replica and is now receiving synchronization updates from other + /// replicas. + /// </summary> + public const int Ldap_RS_TRANSITION_ON = 6; + + + /// <summary> Indicates that the dying replica needs to synchronize with another replica + /// before being converted either to an external reference, if a root replica, + /// or to a subordinate reference, if a non-root replica. + /// </summary> + public const int Ldap_RS_DEAD_REPLICA = 7; + + /// <summary> Indicates that the subordinate references of the new replica are being + /// added. + /// </summary> + public const int Ldap_RS_BEGIN_ADD = 8; + + /// <summary> Indicates that a partition is receiving a new master replica. + /// + /// <p>The replica that will be the new master replica is set to this state.</p> + /// </summary> + public const int Ldap_RS_MASTER_START = 11; + + /// <summary> Indicates that a partition has a new master replica. + /// + /// <p>When the new master is set to this state, Novell eDirectory knows + /// that the replica is now the master and changes its replica type to + /// master and the old master to read/write.</p> + /// </summary> + public const int Ldap_RS_MASTER_DONE = 12; + + /// <summary> Indicates that the partition is going to split into two partitions. + /// + /// <p>In this state, other replicas of the partition are informed of the + /// pending split.</p> + /// </summary> + public const int Ldap_RS_SS_0 = 48; // Replica splitting 0 + + /// <summary> Indicates that that the split partition operation has started. + /// + /// <p>When the split is finished, the state will change to RS_ON.</p> + /// </summary> + public const int Ldap_RS_SS_1 = 49; // Replica splitting 1 + + /// <summary> Indicates that that two partitions are in the process of joining + /// into one partition. + /// + /// <p>In this state, the replicas that are affected are informed of the join + /// operation. The master replica of the parent and child partitions are + /// first set to this state and then all the replicas of the parent and child. + /// New replicas are added where needed.</p> + /// </summary> + public const int Ldap_RS_JS_0 = 64; // Replica joining 0 + + /// <summary> Indicates that that two partitions are in the process of joining + /// into one partition. + /// + /// <p>This state indicates that the join operation is waiting for the new + /// replicas to synchronize and move to the RS_ON state.</p> + /// </summary> + public const int Ldap_RS_JS_1 = 65; // Replica joining 1 + + /// <summary> Indicates that that two partitions are in the process of joining + /// into one partition. + /// + /// <p>This state indicates that all the new replicas are in the RS_ON state + /// and that the rest of the work can be completed.</p> + /// </summary> + public const int Ldap_RS_JS_2 = 66; // Replica joining 2 + + + // Values for flags used in the replica info class structure + + /// <summary> Indicates that the replica is involved with a partition operation, + /// for example, merging a tree or moving a subtree. + /// </summary> + public const int Ldap_DS_FLAG_BUSY = 0x0001; + + /// <summary> Indicates that this partition is on the DNS federation boundary. + /// This flag is only set on DNS trees. + /// </summary> + public const int Ldap_DS_FLAG_BOUNDARY = 0x0002; + + + public ReplicationConstants() + { + } + } +} diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/SchemaSyncRequest.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/SchemaSyncRequest.cs new file mode 100755 index 00000000000..9fd3156cc98 --- /dev/null +++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/SchemaSyncRequest.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.Extensions.SchemaSyncRequest.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; +using Novell.Directory.Ldap.Utilclass; + +namespace Novell.Directory.Ldap.Extensions +{ + + /// <summary> + /// Synchronizes the schema. + /// + /// <p>The requestSchemaSyncRequest extension uses the following OID: <br> + /// 2.16.840.1.113719.1.27.100.27</p> + /// + /// <p>The requestValue has the following format:<br> + /// + /// requestValue ::=<br> + /// serverName LdapDN<br> + /// delay INTEGER</p> + /// </summary> + public class SchemaSyncRequest:LdapExtendedOperation + { + + /// <summary> Constructs an extended operation object for synchronizing the schema. + /// + /// </summary> + /// <param name="serverName"> The distinguished name of the server which will start + /// the synchronization. + /// <br><br> + /// </param> + /// <param name="delay"> The time, in seconds, to delay before the synchronization + /// should start. + /// + /// </param> + /// <exception cref=""> LdapException A general exception which includes an error message + /// and an Ldap error code. + /// </exception> + public SchemaSyncRequest(System.String serverName, int delay):base(ReplicationConstants.SCHEMA_SYNC_REQ, null) + { + + try + { + + if ((System.Object) serverName == null) + throw new System.ArgumentException(ExceptionMessages.PARAM_ERROR); + + System.IO.MemoryStream encodedData = new System.IO.MemoryStream(); + LBEREncoder encoder = new LBEREncoder(); + + Asn1OctetString asn1_serverName = new Asn1OctetString(serverName); + Asn1Integer asn1_delay = new Asn1Integer(delay); + + asn1_serverName.encode(encoder, encodedData); + asn1_delay.encode(encoder, encodedData); + + setValue(SupportClass.ToSByteArray(encodedData.ToArray())); + } + catch (System.IO.IOException ioe) + { + throw new LdapException(ExceptionMessages.ENCODING_ERROR, LdapException.ENCODING_ERROR, (System.String) null); + } + } + } +} diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/SendAllUpdatesRequest.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/SendAllUpdatesRequest.cs new file mode 100755 index 00000000000..50895564cf3 --- /dev/null +++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/SendAllUpdatesRequest.cs @@ -0,0 +1,96 @@ +/****************************************************************************** +* 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.Extensions.SendAllUpdatesRequest.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; +using Novell.Directory.Ldap.Utilclass; + +namespace Novell.Directory.Ldap.Extensions +{ + + /// <summary> + /// Schedules an updated request to be sent to all directory servers in a + /// replica ring. + /// + /// <p>The sendAllUpdatesRequest extension uses the following OID:<br> + /// 2.16.840.1.113719.1.27.100.23</p> + /// + /// <p>The requestValue has the following format:<br> + /// + /// requestValue ::=<br> + /// partitionRoot LdapDN<br> + /// origServerDN LdapDN</p> + /// </summary> + public class SendAllUpdatesRequest:LdapExtendedOperation + { + + /// <summary> + /// Constructs an extended operation object for sending updates to a replica ring. + /// + /// </summary> + /// <param name="partitionRoot">The distinguished name of the replica + /// that will be updated. + /// <br><br> + /// </param> + /// <param name="origServerDN"> The distinguished name of the server that sends the + /// updates to the replica ring. + /// + /// </param> + /// <exception cref=""> LdapException A general exception which includes an error message + /// and an Ldap error code. + /// </exception> + public SendAllUpdatesRequest(System.String partitionRoot, System.String origServerDN):base(ReplicationConstants.SEND_ALL_UPDATES_REQ, null) + { + + try + { + + if (((System.Object) partitionRoot == null) || ((System.Object) origServerDN == null)) + throw new System.ArgumentException(ExceptionMessages.PARAM_ERROR); + System.IO.MemoryStream encodedData = new System.IO.MemoryStream(); + LBEREncoder encoder = new LBEREncoder(); + + Asn1OctetString asn1_partitionRoot = new Asn1OctetString(partitionRoot); + Asn1OctetString asn1_origServerDN = new Asn1OctetString(origServerDN); + + asn1_partitionRoot.encode(encoder, encodedData); + asn1_origServerDN.encode(encoder, encodedData); + + setValue(SupportClass.ToSByteArray(encodedData.ToArray())); + } + catch (System.IO.IOException ioe) + { + throw new LdapException(ExceptionMessages.ENCODING_ERROR, LdapException.ENCODING_ERROR, (System.String) null); + } + } + } +} diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/SetReplicationFilterRequest.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/SetReplicationFilterRequest.cs new file mode 100755 index 00000000000..4a86595eadf --- /dev/null +++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/SetReplicationFilterRequest.cs @@ -0,0 +1,155 @@ +/****************************************************************************** +* 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.Extensions.SetReplicationFilterRequest.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; +using Novell.Directory.Ldap.Utilclass; + +namespace Novell.Directory.Ldap.Extensions +{ + + /// <summary> + /// Sets the Replication filter for all replicas on the server. + /// + /// <p>The filter specified is a an array of classnames-attribute names pairs. </p> + /// + /// <p>To set the filter for all replicas on the connected server, you must + /// create an instance of this class and then call the + /// extendedOperation method with this object as the required + /// LdapExtendedOperation parameter.</p> + /// + /// <p>The SetReplicationFilterRequest extension uses the following OID:<br> + /// 2.16.840.1.113719.1.27.100.35</p> + /// + /// <p>The requestValue has the following format:<br> + /// + /// requestValue ::=<br> + /// serverName LdapDN</p> + /// SEQUENCE of SEQUENCE {</p> + /// classname OCTET STRING</p> + /// SEQUENCE of ATTRIBUTES</p> + /// }</p> + /// where</p> + /// ATTRIBUTES:: OCTET STRING</p> + /// </summary> + public class SetReplicationFilterRequest:LdapExtendedOperation + { + + /// <summary> + /// Constructs an extended operations object which contains the ber encoded + /// replication filter. + /// + /// </summary> + /// <param name="serverDN">The server on which the replication filter needs to be set + /// <br><br> + /// </param> + /// <param name="replicationFilter">An array of String Arrays. Each array starting with + /// a class name followed by the attribute names for that class that should comprise + /// the replication filter. + /// <br><br> + /// </param> + /// <exception cref=""> LdapException A general exception which includes an error + /// message and an Ldap error code. + /// </exception> + public SetReplicationFilterRequest(System.String serverDN, System.String[][] replicationFilter):base(ReplicationConstants.SET_REPLICATION_FILTER_REQ, null) + { + + try + { + + if ((System.Object) serverDN == null) + throw new System.ArgumentException(ExceptionMessages.PARAM_ERROR); + + System.IO.MemoryStream encodedData = new System.IO.MemoryStream(); + LBEREncoder encoder = new LBEREncoder(); + + Asn1OctetString asn1_serverDN = new Asn1OctetString(serverDN); + + // Add the serverDN to encoded data + asn1_serverDN.encode(encoder, encodedData); + + // The toplevel sequenceOF + Asn1SequenceOf asn1_replicationFilter = new Asn1SequenceOf(); + + if (replicationFilter == null) + { + asn1_replicationFilter.encode(encoder, encodedData); + setValue(SupportClass.ToSByteArray(encodedData.ToArray())); + return ; + } + + int i = 0; + // for every element in the array + while ((i < replicationFilter.Length) && (replicationFilter[i] != null)) + { + + + // The following additional Sequence is not needed + // as defined by the Asn1. But the server and the + // C client are encoding it. Remove this when server + // and C client are fixed to conform to the published Asn1. + Asn1Sequence buginAsn1Representation = new Asn1Sequence(); + + // Add the classname to the sequence - + buginAsn1Representation.add(new Asn1OctetString(replicationFilter[i][0])); + + // Start a sequenceOF for attributes + Asn1SequenceOf asn1_attributeList = new Asn1SequenceOf(); + + // For every attribute in the array - remember attributes start after + // the first element + int j = 1; + while ((j < replicationFilter[i].Length) && ((System.Object) replicationFilter[i][j] != null)) + { + + // Add the attribute name to the inner SequenceOf + asn1_attributeList.add(new Asn1OctetString(replicationFilter[i][j])); + j++; + } + + + // Add the attributeList to the sequence - extra add due to bug + buginAsn1Representation.add(asn1_attributeList); + asn1_replicationFilter.add(buginAsn1Representation); + i++; + } + + asn1_replicationFilter.encode(encoder, encodedData); + setValue(SupportClass.ToSByteArray(encodedData.ToArray())); + } + catch (System.IO.IOException ioe) + { + throw new LdapException(ExceptionMessages.ENCODING_ERROR, LdapException.ENCODING_ERROR, (System.String) null); + } + } + } +} diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/SplitOrphanPartitionRequest.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/SplitOrphanPartitionRequest.cs new file mode 100755 index 00000000000..74c83722e01 --- /dev/null +++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/SplitOrphanPartitionRequest.cs @@ -0,0 +1,100 @@ +/****************************************************************************** +* 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.Extensions.SplitOrphanPartitionRequest.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; +using Novell.Directory.Ldap.Utilclass; + +namespace Novell.Directory.Ldap.Extensions +{ + + /// <summary> Splits a new orphan partitiont. + /// + /// <p>To split a new orphan partition, you must create an instance of + /// this class and then call the extendedOperation method with this object + /// as the required LdapExtendedOperation parameter.</p> + /// + /// <p>The SplitOrphanPartitionRequest extension uses the following OID:<br> + /// 2.16.840.1.113719.1.27.100.39</p> + /// + /// <p>The requestValue has the following format:<br> + /// + /// requestValue ::=<br> + /// serverDN LdapDN<br> + /// contextName LdapDN</p> + /// </summary> + public class SplitOrphanPartitionRequest:LdapExtendedOperation + { + + /// <summary> + /// Constructs an extended operation object for creating an orphan partition. + /// + /// + /// </summary> + /// <param name="serverDN"> The distinguished name of the server on which + /// the new orphan partition will reside. + /// <br><br> + /// </param> + /// <param name="contextName">The distinguished name of the + /// new orphan partition. + /// + /// </param> + /// <exception cref=""> LdapException A general exception which includes an error message + /// and an Ldap error code. + /// </exception> + public SplitOrphanPartitionRequest(System.String serverDN, System.String contextName):base(ReplicationConstants.CREATE_ORPHAN_NAMING_CONTEXT_REQ, null) + { + + try + { + + if (((System.Object) serverDN == null) || ((System.Object) contextName == null)) + throw new System.ArgumentException(ExceptionMessages.PARAM_ERROR); + + System.IO.MemoryStream encodedData = new System.IO.MemoryStream(); + LBEREncoder encoder = new LBEREncoder(); + + Asn1OctetString asn1_serverDN = new Asn1OctetString(serverDN); + Asn1OctetString asn1_contextName = new Asn1OctetString(contextName); + + asn1_serverDN.encode(encoder, encodedData); + asn1_contextName.encode(encoder, encodedData); + + setValue(SupportClass.ToSByteArray(encodedData.ToArray())); + } + catch (System.IO.IOException ioe) + { + throw new LdapException(ExceptionMessages.ENCODING_ERROR, LdapException.ENCODING_ERROR, (System.String) null); + } + } + } +} diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/SplitPartitionRequest.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/SplitPartitionRequest.cs new file mode 100755 index 00000000000..bce66be71ad --- /dev/null +++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/SplitPartitionRequest.cs @@ -0,0 +1,101 @@ +/****************************************************************************** +* 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.Extensions.SplitPartitionRequest.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; +using Novell.Directory.Ldap.Utilclass; + +namespace Novell.Directory.Ldap.Extensions +{ + + /// <summary> Creates a new partition. + /// + /// <p>To split a new partition, you must create an instance of this + /// class and then call the extendedOperation method with this + /// object as the required LdapExtendedOperation parameter.</p> + /// + /// <p>The SplitPartitionRequest extension uses the following OID:<br> + /// 2.16.840.1.113719.1.27.100.3</p> + /// + /// <p>The requestValue has the following format:<br> + /// + /// requestValue ::=<br> + /// flags INTEGER<br> + /// dn LdapDN</p> + /// </summary> + public class SplitPartitionRequest:LdapExtendedOperation + { + + /// <summary> + /// Constructs an extended operation object for splitting partition. + /// + /// </summary> + /// <param name="dn"> The distinguished name of the container where the new + /// partition root should be located. + /// <br><br> + /// </param> + /// <param name="flags">Specifies whether all servers in the replica ring must be up before + /// proceeding. When set to zero, the status of the servers is not + /// checked. When set to Ldap_ENSURE_SERVERS_UP, all servers must be up + /// for the operation to proceed. + /// + /// </param> + /// <exception cref=""> LdapException A general exception which includes an error message + /// and an Ldap error code. + /// </exception> + public SplitPartitionRequest(System.String dn, int flags):base(ReplicationConstants.CREATE_NAMING_CONTEXT_REQ, null) + { + + try + { + + if ((System.Object) dn == null) + throw new System.ArgumentException(ExceptionMessages.PARAM_ERROR); + + System.IO.MemoryStream encodedData = new System.IO.MemoryStream(); + LBEREncoder encoder = new LBEREncoder(); + + Asn1Integer asn1_flags = new Asn1Integer(flags); + Asn1OctetString asn1_dn = new Asn1OctetString(dn); + + asn1_flags.encode(encoder, encodedData); + asn1_dn.encode(encoder, encodedData); + + setValue(SupportClass.ToSByteArray(encodedData.ToArray())); + } + catch (System.IO.IOException ioe) + { + throw new LdapException(ExceptionMessages.ENCODING_ERROR, LdapException.ENCODING_ERROR, (System.String) null); + } + } + } +} diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/TriggerBackgroundProcessRequest.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/TriggerBackgroundProcessRequest.cs new file mode 100755 index 00000000000..6e594efcc8d --- /dev/null +++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Extensions/TriggerBackgroundProcessRequest.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.Extensions.TriggerBackgroundProcessRequest.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; +using Novell.Directory.Ldap.Utilclass; + +namespace Novell.Directory.Ldap.Extensions +{ + + /// <summary> This API is used to trigger the specified background process on the + /// Novell eDirectory server. + /// + /// <p>The TriggerBackgroundProcessRequest uses tone of the following OID's + /// depending on the process being triggered:<br> + /// 2.16.840.1.113719.1.27.100.43</p> + /// 2.16.840.1.113719.1.27.100.47</p> + /// 2.16.840.1.113719.1.27.100.49</p> + /// 2.16.840.1.113719.1.27.100.51</p> + /// 2.16.840.1.113719.1.27.100.53</p> + /// 2.16.840.1.113719.1.27.100.55</p> + /// + /// <p>The requestValue has the following format:<br> + /// + /// requestValue ::=<br> + /// NULL + /// </p> + /// </summary> + + public class TriggerBackgroundProcessRequest:LdapExtendedOperation + { + + /// <summary> Constants used to refer to different Novell eDirectory + /// background processes + /// </summary> + public const int Ldap_BK_PROCESS_BKLINKER = 1; + public const int Ldap_BK_PROCESS_JANITOR = 2; + public const int Ldap_BK_PROCESS_LIMBER = 3; + public const int Ldap_BK_PROCESS_SKULKER = 4; + public const int Ldap_BK_PROCESS_SCHEMA_SYNC = 5; + public const int Ldap_BK_PROCESS_PART_PURGE = 6; + + /// <summary> + /// Based on the process ID specified this constructer cosntructs an + /// LdapExtendedOperation object with the apppropriate OID. + /// + /// </summary> + /// <param name="processID"> This id identifies the background process to be triggerd. + /// + /// </param> + /// <exception cref=""> LdapException A general exception which includes an error message + /// and an Ldap error code. + /// </exception> + public TriggerBackgroundProcessRequest(int processID):base(null, null) + { + + switch (processID) + { + + + case Ldap_BK_PROCESS_BKLINKER: + setID(ReplicationConstants.TRIGGER_BKLINKER_REQ); + break; + + case Ldap_BK_PROCESS_JANITOR: + setID(ReplicationConstants.TRIGGER_JANITOR_REQ); + break; + + case Ldap_BK_PROCESS_LIMBER: + setID(ReplicationConstants.TRIGGER_LIMBER_REQ); + break; + + case Ldap_BK_PROCESS_SKULKER: + setID(ReplicationConstants.TRIGGER_SKULKER_REQ); + break; + + case Ldap_BK_PROCESS_SCHEMA_SYNC: + setID(ReplicationConstants.TRIGGER_SCHEMA_SYNC_REQ); + break; + + case Ldap_BK_PROCESS_PART_PURGE: + setID(ReplicationConstants.TRIGGER_PART_PURGE_REQ); + break; + + default: + throw new System.ArgumentException(ExceptionMessages.PARAM_ERROR); + + } + } + } +} |