示例#1
0
        protected override void processRecvSetup()
        {
            /// when is startupRx set before?
            Utils.ensure(!setup.isRemoteSetupReceived(), ChabuErrorCode.PROTOCOL_SETUP_TWICE, "Recveived SETUP twice");
            //		Utils.ensure( activated, ChabuErrorCode.NOT_ACTIVATED, "While receiving the SETUP block, org.chabu was not activated." );

            string pn = getRecvString(8);
            int    pv = recvBuf.getInt();
            int    rs = recvBuf.getInt();
            int    av = recvBuf.getInt();
            string an = getRecvString(56);

            if (!Constants.PROTOCOL_NAME.equals(pn))
            {
                localAbortMessage.setPending(ChabuErrorCode.SETUP_REMOTE_CHABU_NAME,
                                             string.Format("Chabu protocol name mismatch. Expected {0}, received {1}", Constants.PROTOCOL_NAME, pn));
                return;
            }


            ChabuSetupInfo info = new ChabuSetupInfo(rs, av, an);

            setup.setRemote(info);

            if ((pv >> 16) != (Constants.PROTOCOL_VERSION >> 16))
            {
                localAbortMessage.setPending(ChabuErrorCode.SETUP_REMOTE_CHABU_VERSION, string.Format("Chabu Protocol Version: expt 0x{0:X8} recv 0x{1:X8}",
                                                                                                      Constants.PROTOCOL_VERSION, pv));
                return;
            }

            setup.checkConnectingValidator();
        }