// Constructor public PSearchEventSource( LdapConnection conn, string searchBase, int scope, string filter, string[] attrs, bool typesOnly, LdapSearchConstraints constraints, LdapEventType eventchangetype, bool changeonly ) { // validate the input arguments if ((conn == null) || (searchBase == null) || (filter == null) || (attrs == null)) { throw new ArgumentException("Null argument specified"); } mConnection = conn; mSearchBase = searchBase; mScope = scope; mFilter = filter; mAttrs = attrs; mTypesOnly = typesOnly; mEventChangeType = eventchangetype; // make things ready for starting a search operation if (constraints == null) { mSearchConstraints = new LdapSearchConstraints(); } else { mSearchConstraints = constraints; } //Create the persistent search control LdapPersistSearchControl psCtrl = new LdapPersistSearchControl((int)eventchangetype,// any change changeonly, //only get changes true, //return entry change controls true); //control is critcal // add the persistent search control to the search constraints mSearchConstraints.setControls(psCtrl); }
// TODO: why type is ANY..? public SearchReferralEventArgs(LdapMessage sourceMessage, EventClassifiers aClassification, LdapEventType aType) : base(sourceMessage, EventClassifiers.CLASSIFICATION_LDAP_PSEARCH, LdapEventType.LDAP_PSEARCH_ANY) { }
public SearchReferralEventArgs(LdapMessage sourceMessage, EventClassifiers aClassification, LdapEventType aType) : base(sourceMessage, EventClassifiers.CLASSIFICATION_LDAP_PSEARCH, LdapEventType.LDAP_PSEARCH_ANY) // TODO: why type is ANY..? { }
public SearchResultEventArgs( LdapMessage sourceMessage, EventClassifiers aClassification, LdapEventType aType) : base(sourceMessage, EventClassifiers.ClassificationLdapPsearch, aType) { }
public LdapEventArgs( LdapMessage sourceMessage, EventClassifiers aClassification, LdapEventType aType) : base(sourceMessage, aClassification) { eType = aType; }
public SearchReferralEventArgs( LdapMessage sourceMessage, EventClassifiers aClassification, LdapEventType aType) : base(sourceMessage, EventClassifiers.ClassificationLdapPsearch, LdapEventType.LdapPsearchAny) // TODO: why type is ANY..? { }
// Constructor public PSearchEventSource( LdapConnection conn, string searchBase, int scope, string filter, string[] attrs, bool typesOnly, LdapSearchConstraints constraints, LdapEventType eventchangetype, bool changeonly) { // validate the input arguments if (conn == null || searchBase == null || filter == null || attrs == null) { throw new ArgumentException("Null argument specified"); } _mConnection = conn; _mSearchBase = searchBase; _mScope = scope; _mFilter = filter; _mAttrs = attrs; _mTypesOnly = typesOnly; _mEventChangeType = eventchangetype; // make things ready for starting a search operation if (constraints == null) { _mSearchConstraints = new LdapSearchConstraints(); } else { _mSearchConstraints = constraints; } // Create the persistent search control var psCtrl = new LdapPersistSearchControl( (int)eventchangetype, // any change changeonly, // only get changes true, // return entry change controls true); // control is critcal // add the persistent search control to the search constraints _mSearchConstraints.SetControls(psCtrl); } // end of Constructor
protected override bool NotifyEventListeners(LdapMessage sourceMessage, EventClassifiers aClassification, int nType) { bool bListenersNotified = false; if (null == sourceMessage) { return(bListenersNotified); } switch (sourceMessage.Type) { case LdapMessage.SEARCH_RESULT_REFERENCE: if (null != search_referral_event) { search_referral_event(this, new SearchReferralEventArgs( sourceMessage, aClassification, (LdapEventType)nType) ); bListenersNotified = true; } break; case LdapMessage.SEARCH_RESPONSE: if (null != search_result_event) { LdapEventType changeType = LdapEventType.TYPE_UNKNOWN; LdapControl[] controls = sourceMessage.Controls; foreach (LdapControl control in controls) { if (control is LdapEntryChangeControl) { changeType = (LdapEventType)(((LdapEntryChangeControl)control).ChangeType); // TODO: Why is this continue here..? (from Java code..) // TODO: Why are we interested only in the last changeType..? continue; } } // if no changeType then value is TYPE_UNKNOWN search_result_event(this, new SearchResultEventArgs( sourceMessage, aClassification, changeType) ); bListenersNotified = true; } break; case LdapMessage.SEARCH_RESULT: // This is a generic LDAP Event // TODO: Why the type is ANY...? (java code) NotifyDirectoryListeners(new LdapEventArgs(sourceMessage, EventClassifiers.CLASSIFICATION_LDAP_PSEARCH, LdapEventType.LDAP_PSEARCH_ANY)); bListenersNotified = true; break; default: // This seems to be some unknown event. // Let this be notified to generic DirectoryListeners in the base class... break; } return(bListenersNotified); }
public SearchResultEventArgs(LdapMessage sourceMessage, EventClassifiers aClassification, LdapEventType aType) : base(sourceMessage, EventClassifiers.CLASSIFICATION_LDAP_PSEARCH, aType) { }