public TerminateSequence(ReliableMessagingVersion reliableMessagingVersion, UniqueId identifier, Int64 last)
     : base(true)
 {
     this.reliableMessagingVersion = reliableMessagingVersion;
     this.identifier = identifier;
     this.lastMsgNumber = last;
 }
        public TransmissionStrategy(ReliableMessagingVersion reliableMessagingVersion, TimeSpan initRtt,
            int maxWindowSize, bool requestAcks, UniqueId id)
        {
            if (initRtt < TimeSpan.Zero)
            {
                if (DiagnosticUtility.ShouldTrace(TraceEventType.Warning))
                {
                    TraceUtility.TraceEvent(TraceEventType.Warning, TraceCode.WsrmNegativeElapsedTimeDetected,
                    SR.GetString(SR.TraceCodeWsrmNegativeElapsedTimeDetected), this);
                }

                initRtt = ReliableMessagingConstants.UnknownInitiationTime;
            }

            if (maxWindowSize <= 0)
            {
                throw Fx.AssertAndThrow("Argument maxWindow size must be positive.");
            }

            this.id = id;
            this.maxWindowSize = this.lossWindowSize = maxWindowSize;
            this.meanRtt = Math.Min((long)initRtt.TotalMilliseconds, Constants.MaxMeanRtt >> Constants.TimeMultiplier) << Constants.TimeMultiplier;
            this.serrRtt = this.meanRtt >> 1;
            this.window = new SlidingWindow(maxWindowSize);
            this.slowStartThreshold = maxWindowSize;
            this.timeout = Math.Max(((200 << Constants.TimeMultiplier) * 2) + this.meanRtt, this.meanRtt + (this.serrRtt << Constants.ChebychevFactor));
            this.quotaRemaining = Int32.MaxValue;
            this.retryTimer = new IOThreadTimer(new Action<object>(OnRetryElapsed), null, true);
            this.requestAcks = requestAcks;
            this.reliableMessagingVersion = reliableMessagingVersion;
        }
 public WsrmAcknowledgmentHeader(ReliableMessagingVersion reliableMessagingVersion, UniqueId sequenceID, SequenceRangeCollection ranges, bool final, int bufferRemaining) : base(reliableMessagingVersion)
 {
     this.sequenceID = sequenceID;
     this.ranges = ranges;
     this.final = final;
     this.bufferRemaining = bufferRemaining;
 }
 private static WsrmHeaderFault CreateWsrmHeaderFault(ReliableMessagingVersion reliableMessagingVersion, FaultCode code, string subcode, FaultReason reason, XmlDictionaryReader detailReader)
 {
     if (code.IsSenderFault)
     {
         if (subcode == "InvalidAcknowledgement")
         {
             return new InvalidAcknowledgementFault(code, reason, detailReader, reliableMessagingVersion);
         }
         if (subcode == "MessageNumberRollover")
         {
             return new MessageNumberRolloverFault(code, reason, detailReader, reliableMessagingVersion);
         }
         if (subcode == "UnknownSequence")
         {
             return new UnknownSequenceFault(code, reason, detailReader, reliableMessagingVersion);
         }
         if (reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessagingFebruary2005)
         {
             if (subcode == "LastMessageNumberExceeded")
             {
                 return new LastMessageNumberExceededFault(code, reason, detailReader, reliableMessagingVersion);
             }
         }
         else if ((reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessaging11) && (subcode == "SequenceClosed"))
         {
             return new SequenceClosedFault(code, reason, detailReader, reliableMessagingVersion);
         }
     }
     if (!code.IsSenderFault && !code.IsReceiverFault)
     {
         return null;
     }
     return new SequenceTerminatedFault(code, reason, detailReader, reliableMessagingVersion);
 }
 internal static void WriteAckRanges(XmlDictionaryWriter writer, ReliableMessagingVersion reliableMessagingVersion, UniqueId sequenceId, SequenceRangeCollection ranges)
 {
     WsrmFeb2005Dictionary dictionary = XD.WsrmFeb2005Dictionary;
     XmlDictionaryString namespaceUri = WsrmIndex.GetNamespace(reliableMessagingVersion);
     writer.WriteStartElement(dictionary.Identifier, namespaceUri);
     writer.WriteValue(sequenceId);
     writer.WriteEndElement();
     if (ranges.Count == 0)
     {
         if (reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessagingFebruary2005)
         {
             ranges = ranges.MergeWith((long) 0L);
         }
         else if (reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessaging11)
         {
             writer.WriteStartElement(DXD.Wsrm11Dictionary.None, namespaceUri);
             writer.WriteEndElement();
         }
     }
     for (int i = 0; i < ranges.Count; i++)
     {
         writer.WriteStartElement(dictionary.AcknowledgementRange, namespaceUri);
         writer.WriteStartAttribute(dictionary.Lower, null);
         SequenceRange range = ranges[i];
         writer.WriteValue(range.Lower);
         writer.WriteEndAttribute();
         writer.WriteStartAttribute(dictionary.Upper, null);
         SequenceRange range2 = ranges[i];
         writer.WriteValue(range2.Upper);
         writer.WriteEndAttribute();
         writer.WriteEndElement();
     }
 }
 public static CreateSequenceInfo ReadMessage(MessageVersion messageVersion, ReliableMessagingVersion reliableMessagingVersion, ISecureConversationSession securitySession, Message message, MessageHeaders headers)
 {
     CreateSequenceInfo info;
     if (message.IsEmpty)
     {
         string reason = System.ServiceModel.SR.GetString("NonEmptyWsrmMessageIsEmpty", new object[] { WsrmIndex.GetCreateSequenceActionString(reliableMessagingVersion) });
         Message faultReply = WsrmUtilities.CreateCSRefusedProtocolFault(messageVersion, reliableMessagingVersion, reason);
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(WsrmMessageInfo.CreateInternalFaultException(faultReply, reason, new ProtocolException(reason)));
     }
     using (XmlDictionaryReader reader = message.GetReaderAtBodyContents())
     {
         info = CreateSequence.Create(messageVersion, reliableMessagingVersion, securitySession, reader);
         message.ReadFromBodyContentsToEnd(reader);
     }
     info.SetMessageId(messageVersion, headers);
     info.SetReplyTo(messageVersion, headers);
     if (info.AcksTo.Uri != info.ReplyTo.Uri)
     {
         string str2 = System.ServiceModel.SR.GetString("CSRefusedAcksToMustEqualReplyTo");
         Message message3 = WsrmUtilities.CreateCSRefusedProtocolFault(messageVersion, reliableMessagingVersion, str2);
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(WsrmMessageInfo.CreateInternalFaultException(message3, str2, new ProtocolException(str2)));
     }
     info.to = message.Headers.To;
     if ((info.to == null) && (messageVersion.Addressing == AddressingVersion.WSAddressing10))
     {
         info.to = messageVersion.Addressing.AnonymousUri;
     }
     return info;
 }
 public Message CreateMessage(MessageVersion messageVersion, ReliableMessagingVersion reliableMessagingVersion)
 {
     this.SetReliableMessagingVersion(reliableMessagingVersion);
     string faultActionString = WsrmIndex.GetFaultActionString(messageVersion.Addressing, reliableMessagingVersion);
     if (messageVersion.Envelope == EnvelopeVersion.Soap11)
     {
         this.code = this.Get11Code(this.code, this.subcode);
     }
     else
     {
         if (messageVersion.Envelope != EnvelopeVersion.Soap12)
         {
             throw Fx.AssertAndThrow("Unsupported MessageVersion.");
         }
         if (this.code.SubCode == null)
         {
             FaultCode subCode = new FaultCode(this.subcode, WsrmIndex.GetNamespaceString(reliableMessagingVersion));
             this.code = new FaultCode(this.code.Name, this.code.Namespace, subCode);
         }
         this.hasDetail = this.Get12HasDetail();
     }
     Message message = Message.CreateMessage(messageVersion, this, faultActionString);
     this.OnFaultMessageCreated(messageVersion, message);
     return message;
 }
 internal static bool IsDefined(ReliableMessagingVersion reliableMessagingVersion)
 {
     if (reliableMessagingVersion != WSReliableMessaging11)
     {
         return (reliableMessagingVersion == WSReliableMessagingFebruary2005);
     }
     return true;
 }
 public CreateSequence(AddressingVersion addressingVersion, ReliableMessagingVersion reliableMessagingVersion, bool ordered, IClientReliableChannelBinder binder, UniqueId offerIdentifier) : base(true)
 {
     this.addressingVersion = addressingVersion;
     this.reliableMessagingVersion = reliableMessagingVersion;
     this.ordered = ordered;
     this.binder = binder;
     this.offerIdentifier = offerIdentifier;
 }
 public static XmlDictionaryReader GetReaderAtDetailContents(string detailName, string detailNamespace, XmlDictionaryReader headerReader, ReliableMessagingVersion reliableMessagingVersion)
 {
     if (reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessagingFebruary2005)
     {
         return GetReaderAtDetailContentsFeb2005(detailName, detailNamespace, headerReader);
     }
     return GetReaderAtDetailContents11(detailName, detailNamespace, headerReader);
 }
 internal static bool IsDefined(ReliableMessagingVersion reliableMessagingVersion)
 {
     if (reliableMessagingVersion != WSReliableMessaging11)
     {
         return(reliableMessagingVersion == WSReliableMessagingFebruary2005);
     }
     return(true);
 }
 public ReliableOutputConnection(UniqueId id, int maxTransferWindowSize, System.ServiceModel.Channels.MessageVersion messageVersion, ReliableMessagingVersion reliableMessagingVersion, TimeSpan initialRtt, bool requestAcks, TimeSpan sendTimeout)
 {
     this.id = id;
     this.messageVersion = messageVersion;
     this.reliableMessagingVersion = reliableMessagingVersion;
     this.sendTimeout = sendTimeout;
     this.strategy = new TransmissionStrategy(reliableMessagingVersion, initialRtt, maxTransferWindowSize, requestAcks, id);
     this.strategy.RetryTimeoutElapsed = new RetryHandler(this.OnRetryTimeoutElapsed);
     this.strategy.OnException = new ComponentExceptionHandler(this.RaiseOnException);
 }
Esempio n. 13
0
 public ReliableSessionBindingElement()
 {
     this.acknowledgementInterval = ReliableSessionDefaults.AcknowledgementInterval;
     this.flowControlEnabled      = true;
     this.inactivityTimeout       = ReliableSessionDefaults.InactivityTimeout;
     this.maxPendingChannels      = 4;
     this.maxRetryCount           = 8;
     this.maxTransferWindowSize   = 8;
     this.ordered = true;
     this.reliableMessagingVersion = System.ServiceModel.ReliableMessagingVersion.Default;
 }
 public InvalidAcknowledgementFault(FaultCode code, FaultReason reason, XmlDictionaryReader detailReader, ReliableMessagingVersion reliableMessagingVersion) : base(code, "InvalidAcknowledgement", reason, true, false)
 {
     UniqueId id;
     bool flag;
     WsrmAcknowledgmentInfo.ReadAck(reliableMessagingVersion, detailReader, out id, out this.ranges, out flag);
     base.SequenceID = id;
     while (detailReader.IsStartElement())
     {
         detailReader.Skip();
     }
     detailReader.ReadEndElement();
 }
 protected ReliableChannelListenerBase(ReliableSessionBindingElement settings, Binding binding) : base(true, binding)
 {
     this.acknowledgementInterval = settings.AcknowledgementInterval;
     this.flowControlEnabled      = settings.FlowControlEnabled;
     this.inactivityTimeout       = settings.InactivityTimeout;
     this.maxPendingChannels      = settings.MaxPendingChannels;
     this.maxRetryCount           = settings.MaxRetryCount;
     this.maxTransferWindowSize   = settings.MaxTransferWindowSize;
     this.messageVersion          = binding.MessageVersion;
     this.ordered = settings.Ordered;
     this.reliableMessagingVersion = settings.ReliableMessagingVersion;
 }
 private static ActionHeader GetActionHeader(AddressingVersion addressingVersion, ReliableMessagingVersion reliableMessagingVersion, string element)
 {
     WsrmIndex index = null;
     if (reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessagingFebruary2005)
     {
         if (addressingVersion == AddressingVersion.WSAddressingAugust2004)
         {
             if (wsAddressingAug2004WSReliableMessagingFeb2005 == null)
             {
                 wsAddressingAug2004WSReliableMessagingFeb2005 = new WsrmFeb2005Index(addressingVersion);
             }
             index = wsAddressingAug2004WSReliableMessagingFeb2005;
         }
         else if (addressingVersion == AddressingVersion.WSAddressing10)
         {
             if (wsAddressing10WSReliableMessagingFeb2005 == null)
             {
                 wsAddressing10WSReliableMessagingFeb2005 = new WsrmFeb2005Index(addressingVersion);
             }
             index = wsAddressing10WSReliableMessagingFeb2005;
         }
     }
     else
     {
         if (reliableMessagingVersion != ReliableMessagingVersion.WSReliableMessaging11)
         {
             throw Fx.AssertAndThrow("Reliable messaging version not supported.");
         }
         if (addressingVersion == AddressingVersion.WSAddressingAugust2004)
         {
             if (wsAddressingAug2004WSReliableMessaging11 == null)
             {
                 wsAddressingAug2004WSReliableMessaging11 = new Wsrm11Index(addressingVersion);
             }
             index = wsAddressingAug2004WSReliableMessaging11;
         }
         else if (addressingVersion == AddressingVersion.WSAddressing10)
         {
             if (wsAddressing10WSReliableMessaging11 == null)
             {
                 wsAddressing10WSReliableMessaging11 = new Wsrm11Index(addressingVersion);
             }
             index = wsAddressing10WSReliableMessaging11;
         }
     }
     if (index == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ProtocolException(System.ServiceModel.SR.GetString("AddressingVersionNotSupported", new object[] { addressingVersion })));
     }
     return index.GetActionHeader(element);
 }
Esempio n. 17
0
 public ReliableChannelFactory(ReliableSessionBindingElement settings, IChannelFactory <InnerChannel> innerChannelFactory, Binding binding) : base(binding)
 {
     this.acknowledgementInterval = settings.AcknowledgementInterval;
     this.flowControlEnabled      = settings.FlowControlEnabled;
     this.inactivityTimeout       = settings.InactivityTimeout;
     this.maxPendingChannels      = settings.MaxPendingChannels;
     this.maxRetryCount           = settings.MaxRetryCount;
     this.maxTransferWindowSize   = settings.MaxTransferWindowSize;
     this.messageVersion          = binding.MessageVersion;
     this.ordered = settings.Ordered;
     this.reliableMessagingVersion = settings.ReliableMessagingVersion;
     this.innerChannelFactory      = innerChannelFactory;
     this.faultHelper = new SendFaultHelper(binding.SendTimeout, binding.CloseTimeout);
 }
 public static CreateSequenceResponseInfo ReadMessage(MessageVersion messageVersion, ReliableMessagingVersion reliableMessagingVersion, Message message, MessageHeaders headers)
 {
     CreateSequenceResponseInfo info;
     if (message.IsEmpty)
     {
         string str = System.ServiceModel.SR.GetString("NonEmptyWsrmMessageIsEmpty", new object[] { WsrmIndex.GetCreateSequenceResponseActionString(reliableMessagingVersion) });
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(str));
     }
     if (headers.RelatesTo == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new MessageHeaderException(System.ServiceModel.SR.GetString("MissingRelatesToOnWsrmResponseReason", new object[] { XD.WsrmFeb2005Dictionary.CreateSequenceResponse }), messageVersion.Addressing.Namespace, "RelatesTo", false));
     }
     using (XmlDictionaryReader reader = message.GetReaderAtBodyContents())
     {
         info = CreateSequenceResponse.Create(messageVersion.Addressing, reliableMessagingVersion, reader);
         message.ReadFromBodyContentsToEnd(reader);
     }
     info.RelatesTo = headers.RelatesTo;
     return info;
 }
 public static TerminateSequenceInfo ReadMessage(MessageVersion messageVersion, ReliableMessagingVersion reliableMessagingVersion, Message message, MessageHeaders headers)
 {
     TerminateSequenceInfo info;
     if (message.IsEmpty)
     {
         string str = System.ServiceModel.SR.GetString("NonEmptyWsrmMessageIsEmpty", new object[] { WsrmIndex.GetTerminateSequenceActionString(reliableMessagingVersion) });
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(str));
     }
     using (XmlDictionaryReader reader = message.GetReaderAtBodyContents())
     {
         info = TerminateSequence.Create(reliableMessagingVersion, reader);
         message.ReadFromBodyContentsToEnd(reader);
     }
     if (reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessaging11)
     {
         info.SetMessageId(messageVersion, headers);
         info.SetReplyTo(messageVersion, headers);
     }
     return info;
 }
Esempio n. 20
0
 internal ReliableSessionBindingElement(ReliableSessionBindingElement elementToBeCloned) : base(elementToBeCloned)
 {
     this.acknowledgementInterval = ReliableSessionDefaults.AcknowledgementInterval;
     this.flowControlEnabled      = true;
     this.inactivityTimeout       = ReliableSessionDefaults.InactivityTimeout;
     this.maxPendingChannels      = 4;
     this.maxRetryCount           = 8;
     this.maxTransferWindowSize   = 8;
     this.ordered = true;
     this.reliableMessagingVersion = System.ServiceModel.ReliableMessagingVersion.Default;
     this.AcknowledgementInterval  = elementToBeCloned.AcknowledgementInterval;
     this.FlowControlEnabled       = elementToBeCloned.FlowControlEnabled;
     this.InactivityTimeout        = elementToBeCloned.InactivityTimeout;
     this.MaxPendingChannels       = elementToBeCloned.MaxPendingChannels;
     this.MaxRetryCount            = elementToBeCloned.MaxRetryCount;
     this.MaxTransferWindowSize    = elementToBeCloned.MaxTransferWindowSize;
     this.Ordered = elementToBeCloned.Ordered;
     this.ReliableMessagingVersion     = elementToBeCloned.ReliableMessagingVersion;
     this.internalDuplexBindingElement = elementToBeCloned.internalDuplexBindingElement;
 }
 public MessageNumberRolloverFault(FaultCode code, FaultReason reason, XmlDictionaryReader detailReader, ReliableMessagingVersion reliableMessagingVersion) : base(code, "MessageNumberRollover", reason, true, true)
 {
     try
     {
         base.SequenceID = WsrmUtilities.ReadIdentifier(detailReader, reliableMessagingVersion);
         if (reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessaging11)
         {
             ulong num;
             detailReader.ReadStartElement(DXD.Wsrm11Dictionary.MaxMessageNumber, WsrmIndex.GetNamespace(reliableMessagingVersion));
             if (!ulong.TryParse(detailReader.ReadContentAsString(), out num) || (num <= 0L))
             {
                 throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(System.ServiceModel.SR.GetString("InvalidSequenceNumber", new object[] { num })));
             }
             detailReader.ReadEndElement();
         }
     }
     finally
     {
         detailReader.Close();
     }
 }
 public static WsrmAckRequestedInfo ReadHeader(ReliableMessagingVersion reliableMessagingVersion, XmlDictionaryReader reader, MessageHeaderInfo header)
 {
     WsrmFeb2005Dictionary dictionary = XD.WsrmFeb2005Dictionary;
     XmlDictionaryString namespaceUri = WsrmIndex.GetNamespace(reliableMessagingVersion);
     reader.ReadStartElement();
     reader.ReadStartElement(dictionary.Identifier, namespaceUri);
     UniqueId sequenceID = reader.ReadContentAsUniqueId();
     reader.ReadEndElement();
     if ((reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessagingFebruary2005) && reader.IsStartElement(dictionary.MessageNumber, namespaceUri))
     {
         reader.ReadStartElement();
         WsrmUtilities.ReadSequenceNumber(reader, true);
         reader.ReadEndElement();
     }
     while (reader.IsStartElement())
     {
         reader.Skip();
     }
     reader.ReadEndElement();
     return new WsrmAckRequestedInfo(sequenceID, header);
 }
 public static CreateSequenceResponseInfo Create(AddressingVersion addressingVersion, ReliableMessagingVersion reliableMessagingVersion, XmlDictionaryReader reader)
 {
     CreateSequenceResponseInfo info = new CreateSequenceResponseInfo();
     WsrmFeb2005Dictionary dictionary = XD.WsrmFeb2005Dictionary;
     XmlDictionaryString namespaceUri = WsrmIndex.GetNamespace(reliableMessagingVersion);
     reader.ReadStartElement(dictionary.CreateSequenceResponse, namespaceUri);
     reader.ReadStartElement(dictionary.Identifier, namespaceUri);
     info.Identifier = reader.ReadContentAsUniqueId();
     reader.ReadEndElement();
     if (reader.IsStartElement(dictionary.Expires, namespaceUri))
     {
         reader.ReadElementContentAsTimeSpan();
     }
     if ((reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessaging11) && reader.IsStartElement(DXD.Wsrm11Dictionary.IncompleteSequenceBehavior, namespaceUri))
     {
         string str2 = reader.ReadElementContentAsString();
         if (((str2 != "DiscardEntireSequence") && (str2 != "DiscardFollowingFirstGap")) && (str2 != "NoDiscard"))
         {
             string message = System.ServiceModel.SR.GetString("CSResponseWithInvalidIncompleteSequenceBehavior");
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(message));
         }
     }
     if (reader.IsStartElement(dictionary.Accept, namespaceUri))
     {
         reader.ReadStartElement();
         info.AcceptAcksTo = EndpointAddress.ReadFrom(addressingVersion, reader, dictionary.AcksTo, namespaceUri);
         while (reader.IsStartElement())
         {
             reader.Skip();
         }
         reader.ReadEndElement();
     }
     while (reader.IsStartElement())
     {
         reader.Skip();
     }
     reader.ReadEndElement();
     return info;
 }
 public TransmissionStrategy(ReliableMessagingVersion reliableMessagingVersion, TimeSpan initRtt, int maxWindowSize, bool requestAcks, UniqueId id)
 {
     if (initRtt < TimeSpan.Zero)
     {
         throw Fx.AssertAndThrow("Argument initRtt cannot be negative.");
     }
     if (maxWindowSize <= 0)
     {
         throw Fx.AssertAndThrow("Argument maxWindow size must be positive.");
     }
     this.id = id;
     this.maxWindowSize = this.lossWindowSize = maxWindowSize;
     this.meanRtt = Math.Min((long) initRtt.TotalMilliseconds, 0x55555555555555L) << 7;
     this.serrRtt = this.meanRtt >> 1;
     this.window = new SlidingWindow(maxWindowSize);
     this.slowStartThreshold = maxWindowSize;
     this.timeout = Math.Max((long) (0xc800L + this.meanRtt), (long) (this.meanRtt + (this.serrRtt << 2)));
     this.quotaRemaining = 0x7fffffff;
     this.retryTimer = new IOThreadTimer(new Action<object>(this.OnRetryElapsed), null, true);
     this.requestAcks = requestAcks;
     this.reliableMessagingVersion = reliableMessagingVersion;
 }
 public static TerminateSequenceInfo Create(ReliableMessagingVersion reliableMessagingVersion, XmlDictionaryReader reader)
 {
     TerminateSequenceInfo info = new TerminateSequenceInfo();
     WsrmFeb2005Dictionary dictionary = XD.WsrmFeb2005Dictionary;
     XmlDictionaryString namespaceUri = WsrmIndex.GetNamespace(reliableMessagingVersion);
     reader.ReadStartElement(dictionary.TerminateSequence, namespaceUri);
     reader.ReadStartElement(dictionary.Identifier, namespaceUri);
     info.Identifier = reader.ReadContentAsUniqueId();
     reader.ReadEndElement();
     if ((reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessaging11) && reader.IsStartElement(DXD.Wsrm11Dictionary.LastMsgNumber, namespaceUri))
     {
         reader.ReadStartElement();
         info.LastMsgNumber = WsrmUtilities.ReadSequenceNumber(reader, false);
         reader.ReadEndElement();
     }
     while (reader.IsStartElement())
     {
         reader.Skip();
     }
     reader.ReadEndElement();
     return info;
 }
 private static void LookupDetailInformation(ReliableMessagingVersion reliableMessagingVersion, string subcode, out string detailName, out string detailNamespace)
 {
     detailName = null;
     detailNamespace = null;
     string namespaceString = WsrmIndex.GetNamespaceString(reliableMessagingVersion);
     bool flag = reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessagingFebruary2005;
     bool flag2 = reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessaging11;
     if (subcode == "InvalidAcknowledgement")
     {
         detailName = "SequenceAcknowledgement";
         detailNamespace = namespaceString;
     }
     else if (((((subcode == "MessageNumberRollover") || (subcode == "SequenceTerminated")) || (subcode == "UnknownSequence")) || (flag && (subcode == "LastMessageNumberExceeded"))) || (flag2 && (subcode == "SequenceClosed")))
     {
         detailName = "Identifier";
         detailNamespace = namespaceString;
     }
     else
     {
         detailName = null;
         detailNamespace = null;
     }
 }
        public static TerminateSequenceInfo Create(ReliableMessagingVersion reliableMessagingVersion,
            XmlDictionaryReader reader)
        {
            if (reader == null)
            {
                Fx.Assert("Argument reader cannot be null.");
            }

            TerminateSequenceInfo terminateSequenceInfo = new TerminateSequenceInfo();
            WsrmFeb2005Dictionary wsrmFeb2005Dictionary = XD.WsrmFeb2005Dictionary;
            XmlDictionaryString wsrmNs = WsrmIndex.GetNamespace(reliableMessagingVersion);

            reader.ReadStartElement(wsrmFeb2005Dictionary.TerminateSequence, wsrmNs);

            reader.ReadStartElement(wsrmFeb2005Dictionary.Identifier, wsrmNs);
            terminateSequenceInfo.Identifier = reader.ReadContentAsUniqueId();
            reader.ReadEndElement();

            if (reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessaging11)
            {
                if (reader.IsStartElement(DXD.Wsrm11Dictionary.LastMsgNumber, wsrmNs))
                {
                    reader.ReadStartElement();
                    terminateSequenceInfo.LastMsgNumber = WsrmUtilities.ReadSequenceNumber(reader, false);
                    reader.ReadEndElement();
                }
            }

            while (reader.IsStartElement())
            {
                reader.Skip();
            }

            reader.ReadEndElement();

            return terminateSequenceInfo;
        }
Esempio n. 28
0
        public InvalidAcknowledgementFault(FaultCode code, FaultReason reason,
            XmlDictionaryReader detailReader, ReliableMessagingVersion reliableMessagingVersion)
            : base(code, WsrmFeb2005Strings.InvalidAcknowledgement, reason, true, false)
        {
            UniqueId sequenceId;
            bool final;

            WsrmAcknowledgmentInfo.ReadAck(reliableMessagingVersion, detailReader, out sequenceId, out this.ranges,
                out final);

            this.SequenceID = sequenceId;

            while (detailReader.IsStartElement())
            {
                detailReader.Skip();
            }

            detailReader.ReadEndElement();
        }
Esempio n. 29
0
        public static string GetSubcode(XmlDictionaryReader headerReader,
            ReliableMessagingVersion reliableMessagingVersion)
        {
            string subCode = null;

            try
            {
                WsrmFeb2005Dictionary wsrmFeb2005Dictionary = XD.WsrmFeb2005Dictionary;
                XmlDictionaryString wsrmNs = WsrmIndex.GetNamespace(reliableMessagingVersion);
                string ns;

                headerReader.ReadStartElement(wsrmFeb2005Dictionary.SequenceFault, wsrmNs);
                headerReader.ReadStartElement(wsrmFeb2005Dictionary.FaultCode, wsrmNs);
                XmlUtil.ReadContentAsQName(headerReader, out subCode, out ns);

                if (ns != WsrmIndex.GetNamespaceString(reliableMessagingVersion))
                    subCode = null;

                headerReader.ReadEndElement();

                while (headerReader.IsStartElement())
                    headerReader.Skip();

                headerReader.ReadEndElement();
            }
            finally
            {
                headerReader.Close();
            }

            return subCode;
        }
Esempio n. 30
0
 public WsrmSequenceFaultHeader(ReliableMessagingVersion reliableMessagingVersion, WsrmFault fault)
     : base(reliableMessagingVersion)
 {
     this.fault = fault;
 }
Esempio n. 31
0
 public UnknownSequenceFault(FaultCode code, FaultReason reason, XmlDictionaryReader detailReader,
     ReliableMessagingVersion reliableMessagingVersion)
     : base(code, WsrmFeb2005Strings.UnknownSequence, reason, detailReader, reliableMessagingVersion, true, true)
 {
 }
Esempio n. 32
0
 public SequenceTerminatedFault(FaultCode code, FaultReason reason, XmlDictionaryReader detailReader,
     ReliableMessagingVersion reliableMessagingVersion)
     : base(code, WsrmFeb2005Strings.SequenceTerminated, reason, detailReader, reliableMessagingVersion, true, true)
 {
 }
Esempio n. 33
0
 public SequenceClosedFault(FaultCode code, FaultReason reason, XmlDictionaryReader detailReader,
     ReliableMessagingVersion reliableMessagingVersion)
     : base(code, Wsrm11Strings.SequenceClosed, reason, detailReader, reliableMessagingVersion, false, true)
 {
 }
Esempio n. 34
0
        public MessageNumberRolloverFault(FaultCode code, FaultReason reason, XmlDictionaryReader detailReader,
            ReliableMessagingVersion reliableMessagingVersion)
            : base(code, WsrmFeb2005Strings.MessageNumberRollover, reason, true, true)
        {
            try
            {
                this.SequenceID = WsrmUtilities.ReadIdentifier(detailReader, reliableMessagingVersion);

                if (reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessaging11)
                {
                    detailReader.ReadStartElement(DXD.Wsrm11Dictionary.MaxMessageNumber,
                        WsrmIndex.GetNamespace(reliableMessagingVersion));

                    string maxMessageNumberString = detailReader.ReadContentAsString();
                    ulong maxMessageNumber;
                    if (!UInt64.TryParse(maxMessageNumberString, out maxMessageNumber)
                        || (maxMessageNumber <= 0))
                    {
                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(
                            SR.GetString(SR.InvalidSequenceNumber, maxMessageNumber)));
                    }
                    // otherwise ignore value

                    detailReader.ReadEndElement();
                }
            }
            finally
            {
                detailReader.Close();
            }
        }
Esempio n. 35
0
 public LastMessageNumberExceededFault(FaultCode code, FaultReason reason,
     XmlDictionaryReader detailReader, ReliableMessagingVersion reliableMessagingVersion)
     : base(code, WsrmFeb2005Strings.LastMessageNumberExceeded, reason, detailReader, reliableMessagingVersion, false,
     true)
 {
 }
Esempio n. 36
0
 protected WsrmMessageHeader(System.ServiceModel.ReliableMessagingVersion reliableMessagingVersion)
 {
     this.reliableMessagingVersion = reliableMessagingVersion;
 }
 internal static bool IsDefined(ReliableMessagingVersion reliableMessagingVersion)
 {
     return((reliableMessagingVersion == WSReliableMessaging11) ||
            (reliableMessagingVersion == WSReliableMessagingFebruary2005));
 }