public void ProcessEvent(EventWrittenEventArgs e)
        {
            switch (_eventPairTimerConnections.TryGetDuration(e, out var duration1))
            {
            case DurationResult.Start:
                ConnectionStart?.Invoke(Events.ConnectionStartEvent.Instance);
                break;

            case DurationResult.FinalWithDuration:
                ConnectionStop?.InvokeManyTimes(_samplingRate.SampleEvery, Events.ConnectionStopEvent.GetFrom(duration1));
                break;

            default:
                break;
            }

            switch (_eventPairTimerRequests.TryGetDuration(e, out var duration2))
            {
            case DurationResult.Start:
                ConnectionStart?.Invoke(Events.ConnectionStartEvent.Instance);
                break;

            case DurationResult.FinalWithDuration:
                ConnectionStop?.InvokeManyTimes(_samplingRate.SampleEvery, Events.ConnectionStopEvent.GetFrom(duration2));
                break;

            default:
                break;
            }

            if (e.EventId == EventIdConnectionStart)
            {
                ConnectionStart?.Invoke(Events.ConnectionStartEvent.ParseFrom(e));
                return;
            }

            if (e.EventId == EventIdConnectionStop)
            {
                ConnectionStop?.Invoke(Events.ConnectionStopEvent.ParseFrom(e));
                return;
            }

            if (e.EventId == EventIdRequestStart)
            {
                RequestStart?.Invoke(Events.RequestStartEvent.ParseFrom(e));
                return;
            }

            if (e.EventId == EventIdRequestStop)
            {
                RequestStop?.Invoke(Events.RequestStopEvent.ParseFrom(e));
                return;
            }

            if (e.EventId == EventIdConnectionRejected)
            {
                ConnectionRejected?.Invoke(Events.ConnectionRejectedEvent.ParseFrom(e));
                return;
            }
        }
        public override void ConnectionStart(Channel context, ConnectionStart mystruct)
        {
            MemoryStream stResponse = new MemoryStream();

            // do not send username and password for EXTERNAL mechanism,
            // because they are inside a certificate file
            if (_mechanism != "EXTERNAL")
            {
                byte[] part = Encoding.UTF8.GetBytes(_username);
                stResponse.WriteByte(0);
                stResponse.Write(part, 0, part.Length);
                stResponse.WriteByte(0);
                part = Encoding.UTF8.GetBytes(_password);
                stResponse.Write(part, 0, part.Length);
            }
            Dictionary<String, Object> props = new Dictionary<String, Object>();
            context.ConnectionStartOk(props, _mechanism, stResponse.ToArray(), "utf8");
        }
        public override void ConnectionStart(Channel context, ConnectionStart mystruct)
        {
            MemoryStream stResponse = new MemoryStream();

            // do not send username and password for EXTERNAL mechanism,
            // because they are inside a certificate file
            if (_mechanism != "EXTERNAL")
            {
                byte[] part = Encoding.UTF8.GetBytes(_username);
                stResponse.WriteByte(0);
                stResponse.Write(part, 0, part.Length);
                stResponse.WriteByte(0);
                part = Encoding.UTF8.GetBytes(_password);
                stResponse.Write(part, 0, part.Length);
            }
            Dictionary <String, Object> props = new Dictionary <String, Object>();

            context.ConnectionStartOk(props, _mechanism, stResponse.ToArray(), "utf8");
        }
示例#4
0
 public virtual void ConnectionStart(C context, ConnectionStart mystruct)
 {
 }