IsAdminMsgType() public static method

public static IsAdminMsgType ( string msgType ) : bool
msgType string
return bool
コード例 #1
0
        public Message Create(string beginString, string msgType)
        {
            IMessageFactory f = null;

            // FIXME: This is a hack.  FIXT11 could mean 50 or 50sp1 or 50sp2.
            // We need some way to choose which 50 version it is.
            // Choosing 50 here is not adequate.
            if (beginString.Equals(FixValues.BeginString.FIXT11))
            {
                if (!Message.IsAdminMsgType(msgType))
                {
                    f = _factories[FixValues.BeginString.FIX50];
                }
            }
            if (f != null) // really, this should just be in the previous if-block
            {
                return(f.Create(beginString, msgType));
            }



            if (_factories.ContainsKey(beginString) == false)
            {
                Message m = new Message();
                m.Header.SetField(new StringField(QuickFix.Fields.Tags.MsgType, msgType));
                return(m);
            }

            f = _factories[beginString];
            return(f.Create(beginString, msgType));
        }
コード例 #2
0
        public Message Create(string beginString, QuickFix.Fields.ApplVerID applVerID, string msgType)
        {
            _factories.TryGetValue(beginString, out IMessageFactory messageFactory);

            if (beginString == QuickFix.Values.BeginString_FIXT11 && !Message.IsAdminMsgType(msgType))
            {
                if (applVerID == null)
                {
                    applVerID = _defaultApplVerId;
                }
                _factories.TryGetValue(
                    QuickFix.FixValues.ApplVerID.ToBeginString(applVerID.Obj),
                    out messageFactory);
            }

            if (messageFactory != null)
            {
                return(messageFactory.Create(beginString, applVerID, msgType));
            }

            // didn't find a factory, so return a generic Message object
            var message = new Message();

            message.Header.SetField(new StringField(QuickFix.Fields.Tags.MsgType, msgType));
            return(message);
        }
コード例 #3
0
        public Message Create(string beginString, string msgType)
        {
            // FIXME: This is a hack.  FIXT11 could mean 50 or 50sp1 or 50sp2.
            // We need some way to choose which 50 version it is.
            // Choosing 50 here is not adequate.
            var key = beginString.Equals(FixValues.BeginString.FIXT11) && !Message.IsAdminMsgType(msgType)
                ? FixValues.BeginString.FIX50
                : beginString;

            if (_factories.TryGetValue(key, out var factory))
            {
                return(factory.Create(beginString, msgType));
            }
            else
            {
                var message = new Message();
                message.Header.SetField(new StringField(QuickFix.Fields.Tags.MsgType, msgType));
                return(message);
            }
        }
コード例 #4
0
        protected bool SendRaw(Message message, int seqNum)
        {
            lock (sync_)
            {
                string msgType = message.Header.GetField(Fields.Tags.MsgType);

                InitializeHeader(message, seqNum);

                if (Message.IsAdminMsgType(msgType))
                {
                    /// FIXME this.Application.ToAdmin(message, this.SessionID);

                    if (MsgType.LOGON.Equals(msgType) && !state_.ReceivedReset)
                    {
                        Fields.ResetSeqNumFlag resetSeqNumFlag = new QuickFix.Fields.ResetSeqNumFlag(false);
                        if (message.IsSetField(resetSeqNumFlag))
                        {
                            message.GetField(resetSeqNumFlag);
                        }
                        if (resetSeqNumFlag.getValue())
                        {
                            state_.Reset();
                            message.Header.SetField(new Fields.MsgSeqNum(state_.GetNextSenderMsgSeqNum()));
                        }
                        state_.SentReset = resetSeqNumFlag.Obj;
                    }
                }

                string messageString = message.ToString();
                if (0 == seqNum)
                {
                    Persist(message, messageString);
                }
                return(Send(messageString));
            }
        }
コード例 #5
0
        public bool Verify(Message msg, bool checkTooHigh, bool checkTooLow)
        {
            int    msgSeqNum = 0;
            string msgType   = "";

            try
            {
                msgType = msg.Header.GetField(Fields.Tags.MsgType);
                string senderCompID = msg.Header.GetField(Fields.Tags.SenderCompID);
                string targetCompID = msg.Header.GetField(Fields.Tags.TargetCompID);

                if (!IsCorrectCompID(senderCompID, targetCompID))
                {
                    GenerateReject(msg, FixValues.SessionRejectReason.COMPID_PROBLEM);
                    GenerateLogout();
                    return(false);
                }

                if (checkTooHigh || checkTooLow)
                {
                    msgSeqNum = msg.Header.GetInt(Fields.Tags.MsgSeqNum);
                }

                if (checkTooHigh && IsTargetTooHigh(msgSeqNum))
                {
                    DoTargetTooHigh(msg, msgSeqNum);
                    return(false);
                }
                else if (checkTooLow && IsTargetTooLow(msgSeqNum))
                {
                    DoTargetTooLow(msg, msgSeqNum);
                    return(false);
                }

                if ((checkTooHigh || checkTooLow) && state_.ResendRequested())
                {
                    ResendRange range = state_.GetResendRange();
                    if (msgSeqNum >= range.EndSeqNo)
                    {
                        this.Log.OnEvent("ResendRequest for messages FROM: " + range.BeginSeqNo + " TO: " + range.EndSeqNo + " has been satisfied.");
                        state_.SetResendRange(0, 0);
                    }
                }

                if (CheckLatency && !IsGoodTime(msg))
                {
                    this.Log.OnEvent("Sending time accuracy problem");
                    GenerateReject(msg, FixValues.SessionRejectReason.SENDING_TIME_ACCURACY_PROBLEM);
                    GenerateLogout();
                    return(false);
                }
            }
            catch (System.Exception e)
            {
                this.Log.OnEvent("Verify failed: " + e.Message);
                Disconnect("Verify failed: " + e.Message);
                return(false);
            }

            state_.LastReceivedTimeTickCount = System.Environment.TickCount;
            state_.TestRequestCounter        = 0;

            if (Message.IsAdminMsgType(msgType))
            {
                this.Application.FromAdmin(msg, this.SessionID);
            }
            else
            {
                this.Application.FromApp(msg, this.SessionID);
            }

            return(true);
        }
コード例 #6
0
        public void Next(Message message)
        {
            Header header  = message.Header;
            string msgType = "";

            try
            {
                msgType = header.GetField(Fields.Tags.MsgType);
                string beginString = header.GetField(Fields.Tags.BeginString);

                if (!beginString.Equals(this.SessionID.BeginString))
                {
                    throw new UnsupportedVersion();
                }

                if (this.SessionID.IsFIXT && !Message.IsAdminMsgType(msgType))
                {
                    throw new UnsupportedVersion("'FIXT' Sessions are not implemented yet!");
                }
                else
                {
                    this.SessionDataDictionary.Validate(message, beginString, msgType);
                }

                if (MsgType.LOGON.Equals(msgType))
                {
                    NextLogon(message);
                }
                else if (MsgType.HEARTBEAT.Equals(msgType))
                {
                    NextHeartbeat(message);
                }
                else if (MsgType.TEST_REQUEST.Equals(msgType))
                {
                    NextTestRequest(message);
                }
                else if (MsgType.SEQUENCE_RESET.Equals(msgType))
                {
                    NextSequenceReset(message);
                }
                else if (MsgType.LOGOUT.Equals(msgType))
                {
                    NextLogout(message);
                }
                else if (MsgType.RESEND_REQUEST.Equals(msgType))
                {
                    NextResendRequest(message);
                }
                else
                {
                    if (!Verify(message))
                    {
                        return;
                    }
                    state_.IncrNextTargetMsgSeqNum();
                }
            }
            catch (TagException e)
            {
                if (null != e.InnerException)
                {
                    this.Log.OnEvent(e.InnerException.Message);
                }
                GenerateReject(message, e.sessionRejectReason, e.field);
            }
            catch (UnsupportedVersion)
            {
                if (MsgType.LOGOUT.Equals(msgType))
                {
                    NextLogout(message);
                }
                else
                {
                    GenerateLogout("Incorrect BeginString");
                    state_.IncrNextTargetMsgSeqNum();
                }
            }
            catch (UnsupportedMessageType e)
            {
                this.Log.OnEvent("Unsupported message type: " + e.Message);
                GenerateBusinessMessageReject(message, Fields.BusinessRejectReason.UNKNOWN_MESSAGE_TYPE, 0);
            }
            NextQueued();
        }