/// <summary> /// Constructs an LdapExtendedRequest. /// </summary> /// <param name="op"> /// The object which contains (1) an identifier of an extended /// operation which should be recognized by the particular Ldap /// server this client is connected to, and (2) an operation- /// specific sequence of octet strings or BER-encoded values. /// </param> /// <param name="cont"> /// Any controls that apply to the extended request /// or null if none. /// </param> public LdapExtendedRequest(LdapExtendedOperation op, LdapControl[] cont) : base( EXTENDED_REQUEST, new RfcExtendedRequest(new RfcLdapOID(op.getID()), op.getValue() != null ? new Asn1OctetString(op.getValue()) : null), cont) { }
/// <summary> /// Constructs an LdapExtendedRequest. /// </summary> /// <param name="op"> /// The object which contains (1) an identifier of an extended /// operation which should be recognized by the particular Ldap /// server this client is connected to, and (2) an operation- /// specific sequence of octet strings or BER-encoded values. /// </param> /// <param name="cont"> /// Any controls that apply to the extended request /// or null if none. /// </param> public LdapExtendedRequest(LdapExtendedOperation op, LdapControl[] cont) : base( ExtendedRequest, new RfcExtendedRequest( new RfcLdapOid(op.GetId()), op.GetValue() != null ? new Asn1OctetString(op.GetValue()) : null), cont) { }
/// <summary> Formulates the extended operation, constraints into an /// LdapMessage and returns the LdapMessage. This is used by /// extendedOperation and startTLS which needs the LdapMessage to /// get the MessageID. /// </summary> protected internal virtual LdapMessage MakeExtendedOperation(LdapExtendedOperation op, LdapConstraints cons) { // Use default constraints if none-specified if (cons == null) cons = defSearchCons; // error check the parameters if ((System.Object) op.getID() == null) { // Invalid extended operation parameter, no OID specified throw new System.ArgumentException(ExceptionMessages.OP_PARAM_ERROR); } return new LdapExtendedRequest(op, cons.getControls()); }
/* * Asynchronous Ldap extended request with SearchConstraints */ /// <summary> Provides an asynchronous means to access extended, non-mandatory /// operations offered by a particular Ldapv3 compliant server. /// /// </summary> /// <param name="op"> The object which contains (1) an identifier of an extended /// operation which should be recognized by the particular Ldap /// server this client is connected to and (2) an operation- /// specific sequence of octet strings or BER-encoded values. /// /// </param> /// <param name="queue"> The queue for messages returned from a server in /// response to this request. If it is null, a queue /// object is created internally. /// /// </param> /// <param name="cons"> The constraints specific to this operation. /// /// </param> /// <returns> An operation-specific object, containing an ID and either an /// octet string or BER-encoded values. /// /// </returns> /// <exception> LdapException A general exception which includes an error /// message and an Ldap error code. /// </exception> public virtual LdapResponseQueue ExtendedOperation(LdapExtendedOperation op, LdapConstraints cons, LdapResponseQueue queue) { // Use default constraints if none-specified if (cons == null) cons = defSearchCons; LdapMessage msg = MakeExtendedOperation(op, cons); return SendRequestToServer(msg, cons.TimeLimit, queue, null); }
/* * Asynchronous Ldap extended request */ /// <summary> Provides an asynchronous means to access extended, non-mandatory /// operations offered by a particular Ldapv3 compliant server. /// /// </summary> /// <param name="op"> The object which contains (1) an identifier of an extended /// operation which should be recognized by the particular Ldap /// server this client is connected to and (2) an /// operation-specific sequence of octet strings /// or BER-encoded values. /// /// </param> /// <param name="queue"> The queue for messages returned from a server in /// response to this request. If it is null, a queue /// object is created internally. /// /// </param> /// <returns> An operation-specific object, containing an ID and either an octet /// string or BER-encoded values. /// /// </returns> /// <exception> LdapException A general exception which includes an error /// message and an Ldap error code. /// </exception> public virtual LdapResponseQueue ExtendedOperation(LdapExtendedOperation op, LdapResponseQueue queue) { return ExtendedOperation(op, defSearchCons, queue); }
/* * Synchronous Ldap extended request with SearchConstraints */ /// <summary> /// Provides a synchronous means to access extended, non-mandatory /// operations offered by a particular Ldapv3 compliant server. /// /// </summary> /// <param name="op"> The object which contains (1) an identifier of an extended /// operation which should be recognized by the particular Ldap /// server this client is connected to and (2) an /// operation-specific sequence of octet strings /// or BER-encoded values. /// /// </param> /// <param name="cons">The constraints specific to the operation. /// /// </param> /// <returns> An operation-specific object, containing an ID and either an /// octet string or BER-encoded values. /// /// </returns> /// <exception> LdapException A general exception which includes an error /// message and an Ldap error code. /// </exception> public virtual LdapExtendedResponse ExtendedOperation(LdapExtendedOperation op, LdapConstraints cons) { // Call asynchronous API and get back handler to reponse queue LdapResponseQueue queue = ExtendedOperation(op, cons, null); LdapExtendedResponse response = (LdapExtendedResponse) queue.getResponse(); // Set local copy of responseControls synchronously - if there were any lock (responseCtlSemaphore) { responseCtls = response.Controls; } chkResultCode(queue, cons, response); return response; }
//************************************************************************* // extendedOperation methods //************************************************************************* /// <summary> Provides a synchronous means to access extended, non-mandatory /// operations offered by a particular Ldapv3 compliant server. /// /// </summary> /// <param name="op"> The object which contains (1) an identifier of an extended /// operation which should be recognized by the particular Ldap /// server this client is connected to and (2) /// an operation-specific sequence of octet strings /// or BER-encoded values. /// /// </param> /// <returns> An operation-specific object, containing an ID and either an octet /// string or BER-encoded values. /// /// </returns> /// <exception> LdapException A general exception which includes an error /// message and an Ldap error code. /// </exception> public virtual LdapExtendedResponse ExtendedOperation(LdapExtendedOperation op) { return ExtendedOperation(op, defSearchCons); }
/// <summary> Constructs an LdapExtendedRequest. /// /// </summary> /// <param name="op"> The object which contains (1) an identifier of an extended /// operation which should be recognized by the particular Ldap /// server this client is connected to, and (2) an operation- /// specific sequence of octet strings or BER-encoded values. /// /// </param> /// <param name="cont">Any controls that apply to the extended request /// or null if none. /// </param> public LdapExtendedRequest(LdapExtendedOperation op, LdapControl[] cont) : base(LdapMessage.EXTENDED_REQUEST, new RfcExtendedRequest(new RfcLdapOID(op.getID()), (op.getValue() != null)?new Asn1OctetString(op.getValue()):null), cont) { return ; }