public int Search(string base_entry, SearchScope scope, string filter, string[] attrs, bool attrsonly, TimeSpan timeOut, int sizeLimit, out LDAPMessage res) { // FIXME should expose client/server ctrls IntPtr serverctrls = new IntPtr(); IntPtr clientctrls = new IntPtr(); TimeVal tv = TimeVal.FromTimeSpan(timeOut); IntPtr native_res; int rv; rv = ldap_search_ext_s(ld, base_entry, (int)scope, filter, attrs, attrsonly ? 1 : 0, serverctrls, clientctrls, ref tv, sizeLimit, out native_res); if (native_res != IntPtr.Zero) { res = new LDAPMessage(this, native_res); } else { res = null; } return(rv); }
static extern int ldap_search_ext_s(IntPtr ld, string base_entry, int scope, string filter, string[] attrs, int attrsonly, IntPtr serverctrls, IntPtr clientctrls, ref TimeVal timeout, int sizelimit, out IntPtr res);
public static TimeVal FromTimeSpan (TimeSpan span) { TimeVal tv = new TimeVal(); long nanoseconds; /* make sure we're dealing with a positive TimeSpan */ span = span.Duration(); nanoseconds = span.Ticks * 100; tv.tv_sec = (int)(nanoseconds / 1E+09); tv.tv_usec = (int)((nanoseconds % 1E+09) / 1000); return tv; }
public static TimeVal FromTimeSpan(TimeSpan span) { TimeVal tv = new TimeVal(); long nanoseconds; /* make sure we're dealing with a positive TimeSpan */ span = span.Duration(); nanoseconds = span.Ticks * 100; tv.tv_sec = (int)(nanoseconds / 1E+09); tv.tv_usec = (int)((nanoseconds % 1E+09) / 1000); return(tv); }
static extern int ldap_search_ext_s (IntPtr ld, string base_entry, int scope, string filter, string[] attrs, int attrsonly, IntPtr serverctrls, IntPtr clientctrls, ref TimeVal timeout, int sizelimit, out IntPtr res);