public override void QueueEvents(RemoteEvent remoteEvent) { try { if (_eventManager == null) { var(auxHandle, ipAddress, portNumber, timeout) = ConnectionRequest(); _eventManager = new GdsEventManager(auxHandle, ipAddress, portNumber, timeout); _eventManager.Open(); var dummy = _eventManager.StartWaitingForEvents(remoteEvent); } remoteEvent.LocalId++; var epb = remoteEvent.BuildEpb(); var epbData = epb.ToArray(); Xdr.Write(IscCodes.op_que_events); Xdr.Write(_handle); Xdr.WriteBuffer(epbData); Xdr.Write(AddressOfAstRoutine); Xdr.Write(ArgumentToAstRoutine); Xdr.Write(remoteEvent.LocalId); Xdr.Flush(); var response = (GenericResponse)ReadResponse(); remoteEvent.RemoteId = response.ObjectHandle; } catch (IOException ex) { throw IscException.ForIOException(ex); } }
private void DatabaseInfo(byte[] items, byte[] buffer, int bufferLength) { try { Xdr.Write(IscCodes.op_info_database); Xdr.Write(_handle); Xdr.Write(Incarnation); Xdr.WriteBuffer(items, items.Length); Xdr.Write(bufferLength); Xdr.Flush(); var response = (GenericResponse)ReadResponse(); var responseLength = bufferLength; if (response.Data.Length < bufferLength) { responseLength = response.Data.Length; } Buffer.BlockCopy(response.Data, 0, buffer, 0, responseLength); } catch (IOException ex) { throw IscException.ForErrorCode(IscCodes.isc_network_error, ex); } }
private async Task DatabaseInfo(byte[] items, byte[] buffer, int bufferLength, AsyncWrappingCommonArgs async) { try { await Xdr.Write(IscCodes.op_info_database, async).ConfigureAwait(false); await Xdr.Write(_handle, async).ConfigureAwait(false); await Xdr.Write(Incarnation, async).ConfigureAwait(false); await Xdr.WriteBuffer(items, items.Length, async).ConfigureAwait(false); await Xdr.Write(bufferLength, async).ConfigureAwait(false); await Xdr.Flush(async).ConfigureAwait(false); var response = (GenericResponse) await ReadResponse(async).ConfigureAwait(false); var responseLength = bufferLength; if (response.Data.Length < bufferLength) { responseLength = response.Data.Length; } Buffer.BlockCopy(response.Data, 0, buffer, 0, responseLength); } catch (IOException ex) { throw IscException.ForIOException(ex); } }
public void QueueEvents(RemoteEvent remoteEvent) { try { if (_eventManager == null) { ConnectionRequest(out var auxHandle, out var ipAddress, out var portNumber); _eventManager = new GdsEventManager(auxHandle, ipAddress, portNumber); var dummy = _eventManager.WaitForEventsAsync(remoteEvent); } remoteEvent.LocalId++; var epb = remoteEvent.BuildEpb(); var epbData = epb.ToArray(); Xdr.Write(IscCodes.op_que_events); Xdr.Write(_handle); Xdr.WriteBuffer(epbData); Xdr.Write(AddressOfAstRoutine); Xdr.Write(ArgumentToAstRoutine); Xdr.Write(remoteEvent.LocalId); Xdr.Flush(); var response = (GenericResponse)ReadResponse(); remoteEvent.RemoteId = response.ObjectHandle; } catch (IOException ex) { throw IscException.ForErrorCode(IscCodes.isc_network_error, ex); } }
protected virtual void SendCreateToBuffer(DatabaseParameterBuffer dpb, string database) { Xdr.Write(IscCodes.op_create); Xdr.Write(DatabaseObjectId); if (!string.IsNullOrEmpty(Password)) { dpb.Append(IscCodes.isc_dpb_password, Password); } Xdr.WriteBuffer(Encoding.Default.GetBytes(database)); Xdr.WriteBuffer(dpb.ToArray()); }
protected void ProcessTrustedAuthResponse(SspiHelper sspiHelper, ref IResponse response) { while (response is AuthResponse) { var authData = sspiHelper.GetClientSecurity(((AuthResponse)response).Data); Xdr.Write(IscCodes.op_trusted_auth); Xdr.WriteBuffer(authData); Xdr.Flush(); response = ReadResponse(); } }
protected virtual void SendAttachToBuffer(DatabaseParameterBufferBase dpb, string database) { Xdr.Write(IscCodes.op_attach); Xdr.Write(0); if (!string.IsNullOrEmpty(AuthBlock.Password)) { dpb.Append(IscCodes.isc_dpb_password, AuthBlock.Password); } Xdr.WriteBuffer(Encoding2.Default.GetBytes(database)); Xdr.WriteBuffer(dpb.ToArray()); }
protected internal IResponse ProcessCryptCallbackResponseIfNeeded(IResponse response, byte[] cryptKey) { while (response is CryptKeyCallbackResponse) { Xdr.Write(IscCodes.op_crypt_key_callback); Xdr.WriteBuffer(cryptKey); Xdr.Flush(); response = ReadResponse(); } return(response); }
protected override void SendCreateToBuffer(DatabaseParameterBufferBase dpb, string database) { Xdr.Write(IscCodes.op_create); Xdr.Write(0); if (!string.IsNullOrEmpty(AuthBlock.Password)) { dpb.Append(IscCodes.isc_dpb_password, AuthBlock.Password); } dpb.Append(IscCodes.isc_dpb_utf8_filename, 0); Xdr.WriteBuffer(Encoding.UTF8.GetBytes(database)); Xdr.WriteBuffer(dpb.ToArray()); }
protected override void SendCreateToBuffer(DatabaseParameterBuffer dpb, string database) { Xdr.Write(IscCodes.op_create); Xdr.Write(0); if (AuthData != null) { dpb.Append(IscCodes.isc_dpb_specific_auth_data, AuthData); } dpb.Append(IscCodes.isc_dpb_utf8_filename, 0); Xdr.WriteBuffer(Encoding.UTF8.GetBytes(database)); Xdr.WriteBuffer(dpb.ToArray()); }
protected override void SendAttachToBuffer(DatabaseParameterBuffer dpb, string database) { Xdr.Write(IscCodes.op_attach); Xdr.Write(0); if (!string.IsNullOrEmpty(Password)) { dpb.Append(IscCodes.isc_dpb_password, Password); } dpb.Append(IscCodes.isc_dpb_utf8_filename, 0); Xdr.WriteBuffer(Encoding.UTF8.GetBytes(database)); Xdr.WriteBuffer(dpb.ToArray()); }
protected virtual async Task SendCreateToBuffer(DatabaseParameterBufferBase dpb, string database, AsyncWrappingCommonArgs async) { await Xdr.Write(IscCodes.op_create, async).ConfigureAwait(false); await Xdr.Write(DatabaseObjectId, async).ConfigureAwait(false); if (!string.IsNullOrEmpty(Password)) { dpb.Append(IscCodes.isc_dpb_password, Password); } await Xdr.WriteBuffer(Encoding.Default.GetBytes(database), async).ConfigureAwait(false); await Xdr.WriteBuffer(dpb.ToArray(), async).ConfigureAwait(false); }
internal async Task <IResponse> ProcessCryptCallbackResponseIfNeeded(IResponse response, byte[] cryptKey, AsyncWrappingCommonArgs async) { while (response is CryptKeyCallbackResponse cryptResponse) { await Xdr.Write(IscCodes.op_crypt_key_callback, async).ConfigureAwait(false); await Xdr.WriteBuffer(cryptKey, async).ConfigureAwait(false); await Xdr.Flush(async).ConfigureAwait(false); response = await ReadResponse(async).ConfigureAwait(false); } return(response); }
protected async Task <IResponse> ProcessTrustedAuthResponse(SspiHelper sspiHelper, IResponse response, AsyncWrappingCommonArgs async) { while (response is AuthResponse) { var authData = sspiHelper.GetClientSecurity(((AuthResponse)response).Data); await Xdr.Write(IscCodes.op_trusted_auth, async).ConfigureAwait(false); await Xdr.WriteBuffer(authData, async).ConfigureAwait(false); await Xdr.Flush(async).ConfigureAwait(false); response = await ReadResponse(async).ConfigureAwait(false); } return(response); }
protected override async Task SendCreateToBuffer(DatabaseParameterBufferBase dpb, string database, AsyncWrappingCommonArgs async) { await Xdr.Write(IscCodes.op_create, async).ConfigureAwait(false); await Xdr.Write(0, async).ConfigureAwait(false); if (!string.IsNullOrEmpty(Password)) { dpb.Append(IscCodes.isc_dpb_password, Password); } dpb.Append(IscCodes.isc_dpb_utf8_filename, 0); await Xdr.WriteBuffer(Encoding.UTF8.GetBytes(database), async).ConfigureAwait(false); await Xdr.WriteBuffer(dpb.ToArray(), async).ConfigureAwait(false); }
protected override async Task SendCreateToBuffer(DatabaseParameterBufferBase dpb, string database, AsyncWrappingCommonArgs async) { await Xdr.Write(IscCodes.op_create, async).ConfigureAwait(false); await Xdr.Write(0, async).ConfigureAwait(false); if (AuthData != null) { dpb.Append(IscCodes.isc_dpb_specific_auth_data, AuthData); } dpb.Append(IscCodes.isc_dpb_utf8_filename, 0); await Xdr.WriteBuffer(Encoding.UTF8.GetBytes(database), async).ConfigureAwait(false); await Xdr.WriteBuffer(dpb.ToArray(), async).ConfigureAwait(false); }
protected override void SendCreateToBuffer(DatabaseParameterBufferBase dpb, string database) { Xdr.Write(IscCodes.op_create); Xdr.Write(0); if (!AuthBlock.HasClientData) { dpb.Append(IscCodes.isc_dpb_auth_plugin_name, AuthBlock.AcceptPluginName); dpb.Append(IscCodes.isc_dpb_specific_auth_data, AuthBlock.PublicClientData); } else { dpb.Append(IscCodes.isc_dpb_specific_auth_data, AuthBlock.ClientData); } dpb.Append(IscCodes.isc_dpb_utf8_filename, 0); Xdr.WriteBuffer(Encoding.UTF8.GetBytes(database)); Xdr.WriteBuffer(dpb.ToArray()); }
public override async Task QueueEvents(RemoteEvent remoteEvent, AsyncWrappingCommonArgs async) { try { if (_eventManager == null) { var(auxHandle, ipAddress, portNumber) = await ConnectionRequest(async).ConfigureAwait(false); _eventManager = new GdsEventManager(auxHandle, ipAddress, portNumber); await _eventManager.Open(async).ConfigureAwait(false); var dummy = _eventManager.WaitForEvents(remoteEvent, new AsyncWrappingCommonArgs(true)); } remoteEvent.LocalId++; var epb = remoteEvent.BuildEpb(); var epbData = epb.ToArray(); await Xdr.Write(IscCodes.op_que_events, async).ConfigureAwait(false); await Xdr.Write(_handle, async).ConfigureAwait(false); await Xdr.WriteBuffer(epbData, async).ConfigureAwait(false); await Xdr.Write(AddressOfAstRoutine, async).ConfigureAwait(false); await Xdr.Write(ArgumentToAstRoutine, async).ConfigureAwait(false); await Xdr.Write(remoteEvent.LocalId, async).ConfigureAwait(false); await Xdr.Flush(async).ConfigureAwait(false); var response = (GenericResponse) await ReadResponse(async).ConfigureAwait(false); remoteEvent.RemoteId = response.ObjectHandle; } catch (IOException ex) { throw IscException.ForIOException(ex); } }