//Class constructor //takes for arguments: // //'messageCallbacks': An array containing definitions of the MessageHandle delegate, //one for each client, therefore, the lenght of this array will determine the amount //of client connections the server will receive. // //'newConnectionCallback': A definition of the ConnectionHandle delegate. This method //should take care of every client connection received. // //'PORT': Is number of port the server will be listening to for new connections. public Server(MessageHandle[] messageCallbacks, ConnectionHandle newConnectionCallback, int PORT) { this.messageCallbacks = messageCallbacks; this.newConnectionCallback = newConnectionCallback; server = new TcpListener(PORT); totalClients = messageCallbacks.Length; serverThread = new Thread(Run); serverThread.IsBackground = true; isOnline = false; }
public static extern int ldap_get_option_int([In] ConnectionHandle ldapHandle, [In] LdapOption option, ref int outValue);
public static partial int ldap_bind_s(ConnectionHandle ldapHandle, string dn, in SEC_WINNT_AUTH_IDENTITY_EX credentials, BindMethod method);
public static extern int ldap_compare([In] ConnectionHandle ldapHandle, string dn, string attributeName, berval binaryValue, IntPtr servercontrol, IntPtr clientcontrol, ref int messageNumber);
public static extern int ldap_get_option_secInfo([In] ConnectionHandle ldapHandle, [In] LdapOption option, [In, Out] SecurityPackageContextConnectionInformation outValue);
public static extern IntPtr ldap_next_reference([In] ConnectionHandle ldapHandle, [In] IntPtr result);
public static extern int ldap_delete_ext([In] ConnectionHandle ldapHandle, string dn, IntPtr servercontrol, IntPtr clientcontrol, ref int messageNumber);
public static extern int ldap_parse_result_referral([In] ConnectionHandle ldapHandle, [In] IntPtr result, IntPtr serverError, IntPtr dn, IntPtr message, ref IntPtr referral, IntPtr control, byte freeIt);
public static extern int ldap_parse_extended_result([In] ConnectionHandle ldapHandle, [In] IntPtr result, ref IntPtr oid, ref IntPtr data, byte freeIt);
public static extern int ldap_set_option_referral([In] ConnectionHandle ldapHandle, [In] LdapOption option, ref LdapReferralCallback outValue);
public static extern int ldap_start_tls(ConnectionHandle ldapHandle, ref int ServerReturnValue, ref IntPtr Message, IntPtr ServerControls, IntPtr ClientControls);
public static extern int ldap_set_option_ptr([In] ConnectionHandle ldapHandle, [In] LdapOption option, ref IntPtr inValue);
public static extern int ldap_set_option_int([In] ConnectionHandle ld, [In] LdapOption option, ref int inValue);
public static extern int ldap_set_option_servercert([In] ConnectionHandle ldapHandle, [In] LdapOption option, VERIFYSERVERCERT outValue);
public static IConnectionHandle GetConnection(string connectionString, string dbType) { DbProviderFactory factory; DbConnection connection; ConnectionHandle handle; try { factory = GetFactory(dbType); } catch (Exception exception) { throw new Exception("DB: " + dbType, exception); } connection = factory.CreateConnection(); connection.ConnectionString = connectionString; handle = new ConnectionHandle(connection, factory); return handle; }
public static extern int ldap_parse_reference([In] ConnectionHandle ldapHandle, [In] IntPtr result, ref IntPtr referrals, IntPtr ServerControls, byte freeIt);
public static extern int ldap_set_option_clientcert([In] ConnectionHandle ldapHandle, [In] LdapOption option, QUERYCLIENTCERT outValue);
internal static extern int ldap_sasl_interactive_bind([In] ConnectionHandle ld, string dn, string mechanism, IntPtr serverctrls, IntPtr clientctrls, uint flags, [MarshalAs(UnmanagedType.FunctionPtr)] LDAP_SASL_INTERACT_PROC proc, IntPtr defaults);
public static extern int ldap_abandon([In] ConnectionHandle ldapHandle, [In] int messagId);
public static extern int ldap_simple_bind([In] ConnectionHandle ld, string who, string passwd);
public static extern int ldap_rename([In] ConnectionHandle ldapHandle, string dn, string newRdn, string newParentDn, int deleteOldRdn, IntPtr servercontrol, IntPtr clientcontrol, ref int messageNumber);
public static extern int ldap_bind_s([In] ConnectionHandle ld, string who, string passwd, int method);
public static extern IntPtr ldap_get_dn([In] ConnectionHandle ldapHandle, [In] IntPtr result);
public static extern int ldap_extended_operation([In] ConnectionHandle ldapHandle, string oid, berval data, IntPtr servercontrol, IntPtr clientcontrol, ref int messageNumber);
public static extern int ldap_get_option_sechandle([In] ConnectionHandle ldapHandle, [In] LdapOption option, ref SecurityHandle outValue);
public static extern IntPtr ldap_first_attribute([In] ConnectionHandle ldapHandle, [In] IntPtr result, ref IntPtr address);
private int GetInfoInt32Unhandled(ODBC32.SQL_INFO infotype) { byte[] buffer = new byte[4]; ConnectionHandle.GetInfo1(infotype, buffer); return(BitConverter.ToInt32(buffer, 0)); }
public static extern int ldap_create_sort_control(ConnectionHandle handle, IntPtr keys, byte critical, ref IntPtr control);
public static partial int ldap_connect(ConnectionHandle ldapHandle, in LDAP_TIMEVAL timeout);
public static extern IntPtr ldap_next_attribute([In] ConnectionHandle ldapHandle, [In] IntPtr result, [In, Out] IntPtr address);
static UtilityHandle() { UtilityHandle.handle = new ConnectionHandle(); }
public static extern IntPtr ldap_next_entry([In] ConnectionHandle ldapHandle, [In] IntPtr result);
private static DbParameter[] CreateParameters(ConnectionHandle connection, object[] parameterValues) { DbParameter[] parameters = new DbParameter[0]; if (parameterValues != null) { parameters = new DbParameter[parameterValues.Length]; for (int i = 0; i < parameterValues.Length; i++) { object paramValue = parameterValues[i]; //Datetime mapping if (paramValue is DateTime && DateTime.MinValue.Equals((DateTime)paramValue)) paramValue = DBNull.Value; //null mapping if (paramValue == null) paramValue = DBNull.Value; DbParameter parameter = connection.Factory.CreateParameter(); parameter.ParameterName = "prm" + i; parameter.Value = paramValue; parameters[i] = parameter; } } return parameters; }
public static extern int ldap_search([In] ConnectionHandle ldapHandle, string dn, int scope, string filter, IntPtr attributes, bool attributeOnly, IntPtr servercontrol, IntPtr clientcontrol, int timelimit, int sizelimit, ref int messageNumber);