protected override async Task OnConnectionSendAsync(Message message, TimeSpan timeout, bool saveHandledException, bool maskUnhandledException) { MaskingMode maskingMode = maskUnhandledException ? MaskingMode.Unhandled : MaskingMode.None; if (saveHandledException) { try { await Binder.SendAsync(message, timeout, maskingMode); } catch (Exception e) { if (Fx.IsFatal(e)) { throw; } if (Binder.IsHandleable(e)) { MaxRetryCountException = e; } else { throw; } } } else { maskingMode |= MaskingMode.Handled; await Binder.SendAsync(message, timeout, maskingMode); } }
public IAsyncResult BeginRequest(Message message, TimeSpan timeout, MaskingMode maskingMode, AsyncCallback callback, object state) { RequestAsyncResult <TChannel> result = new RequestAsyncResult <TChannel>((ClientReliableChannelBinder <TChannel>) this, callback, state); result.Start(message, timeout, maskingMode); return(result); }
private void InitWindowMask() { maskBytes = new byte[10]; Array.Copy(originalMaskBytes, maskBytes, maskBytes.Length); masking = MaskingMode.Window; currentMaskByte = 0; }
public int InitMask() { switch (Settings.s.encryption) { case Settings.Encryption.ReadInit: ReadMask(); return(4); case Settings.Encryption.Window: InitWindowMask(); return(0); case Settings.Encryption.FixedInit: mask = 0x6AB5CC79; return(0); case Settings.Encryption.RedPlanet: ReadUInt32(); mask = 0x6AB5CC79; masking = MaskingMode.RedPlanet; return(4); case Settings.Encryption.CalculateInit: uint currentMask = 0xFFFFFFFF; // 0x075BD924 = 123459876 mask = (uint)(16807 * (currentMask ^ 0x75BD924) - (((currentMask ^ 0x75BD924) / -127773 << 31) - (currentMask ^ 0x75BD924) / 127773)); if ((mask & 0x80000000) != 0) { mask += 0x7FFFFFFF; currentMask = mask; } return(0); default: return(0); } }
protected override void OnConnectionSend(Message message, TimeSpan timeout, bool saveHandledException, bool maskUnhandledException) { MaskingMode maskingMode = maskUnhandledException ? MaskingMode.Unhandled : MaskingMode.None; Message message2 = null; if (saveHandledException) { try { message2 = this.binder.Request(message, timeout, maskingMode); return; } catch (Exception exception) { if (Fx.IsFatal(exception)) { throw; } if (!base.Binder.IsHandleable(exception)) { throw; } base.MaxRetryCountException = exception; return; } } maskingMode |= MaskingMode.Handled; message2 = this.binder.Request(message, timeout, maskingMode); if (message2 != null) { base.ProcessMessage(message2); } }
protected override IAsyncResult BeginOutput( ClientReliableChannelBinder <TChannel> binder, TChannel channel, Message message, TimeSpan timeout, MaskingMode maskingMode, AsyncCallback callback, object state) { return(binder.OnBeginRequest(channel, message, timeout, maskingMode, callback, state)); }
public Message Request(Message message, TimeSpan timeout, MaskingMode maskingMode) { if (!this.ValidateOutputOperation(message, timeout, maskingMode)) { return(null); } bool autoAborted = false; try { TimeoutHelper timeoutHelper = new TimeoutHelper(timeout); TChannel channel; if (!this.Synchronizer.TryGetChannelForOutput(timeoutHelper.RemainingTime(), maskingMode, out channel)) { if (!ReliableChannelBinderHelper.MaskHandled(maskingMode)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError( new TimeoutException(SR.GetString(SR.TimeoutOnRequest, timeout))); } return(null); } if (channel == null) { return(null); } try { return(this.OnRequest(channel, message, timeoutHelper.RemainingTime(), maskingMode)); } finally { autoAborted = this.Synchronizer.Aborting; this.Synchronizer.ReturnChannel(); } } catch (Exception e) { if (Fx.IsFatal(e)) { throw; } if (!this.HandleException(e, maskingMode, autoAborted)) { throw; } else { return(null); } } }
public ReplyServerReliableChannelBinder(ChannelBuilder builder, EndpointAddress remoteAddress, MessageFilter filter, int priority, MaskingMode maskingMode, TolerateFaultsMode faultMode, TimeSpan defaultCloseTimeout, TimeSpan defaultSendTimeout) : base(builder, remoteAddress, filter, priority, maskingMode, faultMode, defaultCloseTimeout, defaultSendTimeout) { }
public IAsyncResult BeginRequest(Message message, TimeSpan timeout, MaskingMode maskingMode, AsyncCallback callback, object state) { RequestAsyncResult result = new RequestAsyncResult(this, callback, state); result.Start(message, timeout, maskingMode); return(result); }
public ReplyServerReliableChannelBinder(TReplyChannel channel, EndpointAddress cachedLocalAddress, EndpointAddress remoteAddress, MaskingMode maskingMode, TolerateFaultsMode faultMode, TimeSpan defaultCloseTimeout, TimeSpan defaultSendTimeout) : base(channel, cachedLocalAddress, remoteAddress, maskingMode, faultMode, defaultCloseTimeout, defaultSendTimeout) { }
public async Task <Message> RequestAsync(Message message, TimeSpan timeout, MaskingMode maskingMode) { if (!ValidateOutputOperation(message, timeout, maskingMode)) { return(null); } bool autoAborted = false; try { TimeoutHelper timeoutHelper = new TimeoutHelper(timeout); (bool success, TChannel channel) = await Synchronizer.TryGetChannelForOutputAsync(timeoutHelper.RemainingTime(), maskingMode); if (!success) { if (!ReliableChannelBinderHelper.MaskHandled(maskingMode)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError( new TimeoutException(SR.Format(SR.TimeoutOnRequest, timeout))); } return(null); } if (channel == null) { return(null); } try { return(await OnRequestAsync(channel, message, timeoutHelper.RemainingTime(), maskingMode)); } finally { autoAborted = Synchronizer.Aborting; Synchronizer.ReturnChannel(); } } catch (Exception e) { if (Fx.IsFatal(e)) { throw; } if (!HandleException(e, maskingMode, autoAborted)) { throw; } else { return(null); } } }
protected ServerReliableChannelBinder(TChannel channel, EndpointAddress cachedLocalAddress, EndpointAddress remoteAddress, MaskingMode maskingMode, TolerateFaultsMode faultMode, TimeSpan defaultCloseTimeout, TimeSpan defaultSendTimeout) : base(channel, maskingMode, faultMode, defaultCloseTimeout, defaultSendTimeout) { this.cachedLocalAddress = cachedLocalAddress; this.remoteAddress = remoteAddress; }
void OnConnectionSend(MessageAttemptInfo attemptInfo, TimeSpan timeout, bool maskUnhandledException) { using (attemptInfo.Message) { if (attemptInfo.RetryCount > this.settings.MaxRetryCount) { if (TD.MaxRetryCyclesExceededIsEnabled()) { TD.MaxRetryCyclesExceeded(SR.GetString(SR.MaximumRetryCountExceeded)); } this.session.OnLocalFault(new CommunicationException(SR.GetString(SR.MaximumRetryCountExceeded), this.maxRetryCountException), SequenceTerminatedFault.CreateMaxRetryCountExceededFault(this.session.OutputID), null); return; } this.AddAcknowledgementHeader(attemptInfo.Message, false); this.session.OnLocalActivity(); Message reply = null; MaskingMode maskingMode = maskUnhandledException ? MaskingMode.Unhandled : MaskingMode.None; if (attemptInfo.RetryCount < this.settings.MaxRetryCount) { maskingMode |= MaskingMode.Handled; reply = this.binder.Request(attemptInfo.Message, timeout, maskingMode); } else { try { reply = this.binder.Request(attemptInfo.Message, timeout, maskingMode); } catch (Exception e) { if (Fx.IsFatal(e)) { throw; } if (this.binder.IsHandleable(e)) { this.maxRetryCountException = e; } else { throw; } } } if (reply != null) { ProcessReply(reply, (IReliableRequest)attemptInfo.State, attemptInfo.GetSequenceNumber()); } } }
private async Task OnConnectionSendAsync(MessageAttemptInfo attemptInfo, TimeSpan timeout, bool maskUnhandledException) { using (attemptInfo.Message) { if (attemptInfo.RetryCount > settings.MaxRetryCount) { if (WcfEventSource.Instance.MaxRetryCyclesExceededIsEnabled()) { WcfEventSource.Instance.MaxRetryCyclesExceeded(SR.MaximumRetryCountExceeded); } session.OnLocalFault(new CommunicationException(SR.MaximumRetryCountExceeded, maxRetryCountException), SequenceTerminatedFault.CreateMaxRetryCountExceededFault(session.OutputID), null); return; } AddAcknowledgementHeader(attemptInfo.Message, false); session.OnLocalActivity(); Message reply = null; MaskingMode maskingMode = maskUnhandledException ? MaskingMode.Unhandled : MaskingMode.None; if (attemptInfo.RetryCount < settings.MaxRetryCount) { maskingMode |= MaskingMode.Handled; reply = await binder.RequestAsync(attemptInfo.Message, timeout, maskingMode); } else { try { reply = await binder.RequestAsync(attemptInfo.Message, timeout, maskingMode); } catch (Exception e) { if (Fx.IsFatal(e)) { throw; } if (binder.IsHandleable(e)) { maxRetryCountException = e; } else { throw; } } } if (reply != null) { ProcessReply(reply, (IReliableRequest)attemptInfo.State, attemptInfo.GetSequenceNumber()); } } }
public SensitiveDataEnricher(MaskingMode maskingMode, IEnumerable <IMaskingOperator> maskingOperators) { _maskingMode = maskingMode; var fields = typeof(LogEvent).GetFields(BindingFlags.Instance | BindingFlags.NonPublic); _messageTemplateBackingField = fields.SingleOrDefault(f => f.Name.Contains("<MessageTemplate>")); _maskingOperators = maskingOperators.ToList(); }
protected ClientReliableChannelBinder(EndpointAddress to, Uri via, IChannelFactory <TChannel> factory, MaskingMode maskingMode, TolerateFaultsMode faultMode, ChannelParameterCollection channelParameters, TimeSpan defaultCloseTimeout, TimeSpan defaultSendTimeout) : base(factory.CreateChannel(to, via), maskingMode, faultMode, defaultCloseTimeout, defaultSendTimeout) { _to = to; Via = via; _factory = factory; _channelParameters = channelParameters ?? throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(channelParameters)); }
public Message Request(Message message, TimeSpan timeout, MaskingMode maskingMode) { Message message2; if (!base.ValidateOutputOperation(message, timeout, maskingMode)) { return(null); } bool autoAborted = false; try { TChannel local; TimeoutHelper helper = new TimeoutHelper(timeout); if (!base.Synchronizer.TryGetChannelForOutput(helper.RemainingTime(), maskingMode, out local)) { if (!ReliableChannelBinderHelper.MaskHandled(maskingMode)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new TimeoutException(System.ServiceModel.SR.GetString("TimeoutOnRequest", new object[] { timeout }))); } return(null); } if (local == null) { message2 = null; } else { try { message2 = this.OnRequest(local, message, helper.RemainingTime(), maskingMode); } finally { autoAborted = base.Synchronizer.Aborting; base.Synchronizer.ReturnChannel(); } } } catch (Exception exception) { if (Fx.IsFatal(exception)) { throw; } if (!base.HandleException(exception, maskingMode, autoAborted)) { throw; } message2 = null; } return(message2); }
protected override Task <Message> OnRequestAsync(TRequestChannel channel, Message message, TimeSpan timeout, MaskingMode maskingMode) { if (channel is IAsyncRequestChannel) { return(((IAsyncRequestChannel)channel).RequestAsync(message, timeout)); } else { return(Task.Factory.FromAsync(channel.BeginRequest, channel.EndRequest, message, timeout, null)); } }
IAsyncResult BeginSendAckRequestedMessage(TimeSpan timeout, MaskingMode maskingMode, AsyncCallback callback, object state) { this.session.OnLocalActivity(); ReliableBinderRequestAsyncResult requestResult = new ReliableBinderRequestAsyncResult(callback, state); requestResult.Binder = this.binder; requestResult.MaskingMode = maskingMode; requestResult.Message = this.CreateAckRequestedMessage(); requestResult.Begin(timeout); return(requestResult); }
public PlayfieldMaskingContainer(Drawable content, MaskingMode mode) { RelativeSizeAxes = Axes.Both; InternalChild = new BufferedContainer { RelativeSizeAxes = Axes.Both, Size = new Vector2(1.5f), Anchor = Anchor.Centre, Origin = Anchor.Centre, Children = new[] { new Container { Size = TauPlayfield.BASE_SIZE, Anchor = Anchor.Centre, Origin = Anchor.Centre, Child = content }, new Container { Anchor = Anchor.Centre, Origin = Anchor.Centre, Size = new Vector2(2f), RelativeSizeAxes = Axes.Both, Blending = new BlendingParameters { // Don't change the destination colour. RGBEquation = BlendingEquation.Add, Source = BlendingType.Zero, Destination = BlendingType.One, // Subtract the cover's alpha from the destination (points with alpha 1 should make the destination completely transparent). AlphaEquation = BlendingEquation.Add, SourceAlpha = BlendingType.Zero, DestinationAlpha = mode == MaskingMode.FadeOut ? BlendingType.OneMinusSrcAlpha : BlendingType.SrcAlpha }, Child = cover = new PlayfieldMaskDrawable() } } }; }
protected override async Task OnConnectionSendAsync(Message message, TimeSpan timeout, bool saveHandledException, bool maskUnhandledException) { MaskingMode maskingMode = maskUnhandledException ? MaskingMode.Unhandled : MaskingMode.None; Message reply = null; if (saveHandledException) { try { reply = await binder.RequestAsync(message, timeout, maskingMode); } catch (Exception e) { if (Fx.IsFatal(e)) { throw; } if (Binder.IsHandleable(e)) { MaxRetryCountException = e; } else { throw; } } } else { maskingMode |= MaskingMode.Handled; reply = await binder.RequestAsync(message, timeout, maskingMode); if (reply != null) { await ProcessMessageAsync(reply); } } }
protected override void OnConnectionSendMessage(Message message, TimeSpan timeout, MaskingMode maskingMode) { Message message2 = this.binder.Request(message, timeout, maskingMode); if (message2 != null) { base.ProcessMessage(message2); } }
protected override Task OnConnectionSendMessageAsync(Message message, TimeSpan timeout, MaskingMode maskingMode) { return(Binder.SendAsync(message, timeout, maskingMode)); }
protected override async Task OnConnectionSendMessageAsync(Message message, TimeSpan timeout, MaskingMode maskingMode) { Message reply = await binder.RequestAsync(message, timeout, maskingMode); if (reply != null) { await ProcessMessageAsync(reply); } }
protected abstract Task OnConnectionSendMessageAsync(Message message, TimeSpan timeout, MaskingMode maskingMode);
protected override void OnConnectionSendMessage(Message message, TimeSpan timeout, MaskingMode maskingMode) { Message reply = this.binder.Request(message, timeout, maskingMode); if (reply != null) { ProcessMessage(reply); } }
protected override void OnConnectionSendMessage(Message message, TimeSpan timeout, MaskingMode maskingMode) { this.Binder.Send(message, timeout, maskingMode); }
// Turn off masking for this binary reader public void MaskingOff() { masking = MaskingMode.Off; }
public void SetMask(uint mask) { this.mask = mask; masking = MaskingMode.Number; }
public static IClientReliableChannelBinder CreateBinder(EndpointAddress to, Uri via, IChannelFactory <TChannel> factory, MaskingMode maskingMode, TolerateFaultsMode faultMode, ChannelParameterCollection channelParameters, TimeSpan defaultCloseTimeout, TimeSpan defaultSendTimeout) { Type type = typeof(TChannel); if (type == typeof(IDuplexChannel)) { return(new DuplexClientReliableChannelBinder(to, via, (IChannelFactory <IDuplexChannel>)(object) factory, maskingMode, channelParameters, defaultCloseTimeout, defaultSendTimeout)); } else if (type == typeof(IDuplexSessionChannel)) { return(new DuplexSessionClientReliableChannelBinder(to, via, (IChannelFactory <IDuplexSessionChannel>)(object) factory, maskingMode, faultMode, channelParameters, defaultCloseTimeout, defaultSendTimeout)); } else if (type == typeof(IRequestChannel)) { return(new RequestClientReliableChannelBinder(to, via, (IChannelFactory <IRequestChannel>)(object) factory, maskingMode, channelParameters, defaultCloseTimeout, defaultSendTimeout)); } else if (type == typeof(IRequestSessionChannel)) { return(new RequestSessionClientReliableChannelBinder(to, via, (IChannelFactory <IRequestSessionChannel>)(object) factory, maskingMode, faultMode, channelParameters, defaultCloseTimeout, defaultSendTimeout)); } else { throw Fx.AssertAndThrow("ClientReliableChannelBinder supports creation of IDuplexChannel, IDuplexSessionChannel, IRequestChannel, and IRequestSessionChannel only."); } }
protected abstract void OnConnectionSendMessage(Message message, TimeSpan timeout, MaskingMode maskingMode);
protected override void OnConnectionSendMessage(Message message, TimeSpan timeout, MaskingMode maskingMode) { base.Binder.Send(message, timeout, maskingMode); }