Exemple #1
0
        public void FromAdmin(QuickFix.Message msg, QuickFix.SessionID s)
        {
            string errormsg = "Error: ";

            try
            {
                string msgType = msg.Header.GetField(Tags.MsgType);
                if (msgType == MsgType.LOGON)
                {
                    QuickFix.FIX44.Logon logonMsg = msg as QuickFix.FIX44.Logon;
                    if (logonMsg != null)
                    {
                        // Validates sender & target compids
                        string sndCompID = s.SenderCompID;
                        string tgtCompID = s.TargetCompID;
                        string password  = logonMsg.IsSetField(96)? logonMsg.GetString(96): string.Empty;

                        logger.DebugFormat("snd[{0}] tgt[{1}] pwd[{2}]", sndCompID, tgtCompID, password);
                        if (!_validateLogon(sndCompID, tgtCompID, password))
                        {
                            logger.Info("Não foi possivel autenticar sessao acceptor");
                            QuickFix.FIX44.Logout logout = new QuickFix.FIX44.Logout();
                            logout.Set(new Text("This 4.4 session was not authorized"));
                            Session.SendToTarget(logout, s);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                errormsg += ex.Message;
                logger.Error("FromAdmin: " + ex.Message, ex);
            }
        }
Exemple #2
0
        public void HeaderGroupParsingTest()
        {
            string data = "8=FIX.4.4\x01" + "9=40\x01" + "35=A\x01"
                          + "627=2\x01" + "628=FOO\x01" + "628=BAR\x01"
                          + "98=0\x01" + "384=2\x01" + "372=D\x01" + "385=R\x01" + "372=8\x01" + "385=S\x01" + "10=228\x01";

            QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary();
            dd.Load("../../../spec/fix/FIX44.xml");
            var nos = new QuickFix.FIX44.Logon();

            nos.FromString(data, false, dd, dd, _defaultMsgFactory);
            Group hops = nos.Header.GetGroup(1, Tags.NoHops);

            Assert.That(hops.GetString(Tags.HopCompID), Is.EqualTo("FOO"));
            hops = nos.Header.GetGroup(2, Tags.NoHops);
            Assert.That(hops.GetString(Tags.HopCompID), Is.EqualTo("BAR"));
        }
        /// <summary>
        /// Set parameters before sending the message
        /// </summary>
        /// <param name="message"></param>
        /// <param name="sessionId"></param>
        private void OnMessage(QuickFix.FIX44.Logon message, SessionID sessionId)
        {
            try
            {
                QuickFix.Fields.ResetSeqNumFlag resetSeqNumFlag = new QuickFix.Fields.ResetSeqNumFlag(true);
                QuickFix.Fields.EncryptMethod   encryptMethod   = new QuickFix.Fields.EncryptMethod(0);
                QuickFix.Fields.HeartBtInt      heartBtInt      = new QuickFix.Fields.HeartBtInt(GetHeartBeatInterval());

                // Set values in the message body before sending
                message.ResetSeqNumFlag = resetSeqNumFlag;
                message.EncryptMethod   = encryptMethod;
                message.HeartBtInt      = heartBtInt;
            }
            catch (Exception exception)
            {
                Logger.Error(exception.ToString(), _type.FullName, "OnMessage");
            }
        }
Exemple #4
0
 public void OnMessage(QuickFix.FIX44.Logon ord, SessionID sessionID)
 {
     Console.WriteLine("eeee");
 }
Exemple #5
0
        public void HeaderGroupParsingTest()
        {
            string data = "8=FIX.4.4\x01" + "9=40\x01" + "35=A\x01"
                + "627=2\x01" + "628=FOO\x01" + "628=BAR\x01"
                + "98=0\x01" + "384=2\x01" + "372=D\x01" + "385=R\x01" + "372=8\x01" + "385=S\x01" + "10=228\x01";

            QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary();
            dd.Load("../../../spec/fix/FIX44.xml");
            var nos = new QuickFix.FIX44.Logon();
            nos.FromString(data, false, dd, dd, _defaultMsgFactory);
            Group hops = nos.Header.GetGroup(1, Tags.NoHops);
            Assert.That(hops.GetString(Tags.HopCompID), Is.EqualTo("FOO"));
            hops = nos.Header.GetGroup(2, Tags.NoHops);
            Assert.That(hops.GetString(Tags.HopCompID), Is.EqualTo("BAR"));
        }
Exemple #6
0
 public void OnMessage(QuickFix.FIX44.Logon logon, SessionID sessionID)
 {
     Console.WriteLine("Logon");
 }