示例#1
0
        public void onRequest(Session issuer, Message msg)
        {
            h101dispatcher tuner = null;

            StatusMessage = "";

            string version = (string)msg.getProperty(XGEN_TAG_VERSION);

            if (null == version || 0 == version.Trim().CompareTo("") || 0 != version.CompareTo(XGEN_VERSION))
            {
                sendReply(issuer, msg, msg.createReply(), "-21", "Unexpected Version!");// XGEN_ERR_UNEXPECTED_VERSION -0x15
                return;
            }

            string module = (string)msg.getProperty(XGEN_TAG_MODULE);

            if (null == module || 0 == module.Trim().CompareTo(""))
            {
                module = (string)msg.getProperty(XGEN_TAG_INTERFACE);
            }
            if (null == module || 0 == module.Trim().CompareTo("") || null == (tuner = (h101dispatcher)this.dispatchers[module]))
            {
                sendReply(issuer, msg, msg.createReply(), "-22", "Unexpected Module!");// XGEN_ERR_UNEXPECTED_MODULE -0x16
                return;
            }

            HostInfo.peerName = (string)msg.getProperty(XGEN_TAG_HOSTNAME);
            HostInfo.peerAddr = (string)msg.getProperty(XGEN_TAG_HOSTADDR);

            tunerPrologue(msg);
            tunerEpilogue(msg, null, tuner.dispatch(issuer, msg));
        }
示例#2
0
        public void onUnicast(Session issuer, Message msg)
        {
            h101dispatcher tuner = null;

            StatusMessage = "";

            string version = (string)msg.getProperty(XGEN_TAG_VERSION);

            if (null == version || 0 == version.Trim().CompareTo("") || 0 != version.CompareTo(XGEN_VERSION))
            {
                return;
            }

            string module = (string)msg.getProperty(XGEN_TAG_MODULE);

            if (null == module || 0 == module.Trim().CompareTo(""))
            {
                module = (string)msg.getProperty(XGEN_TAG_INTERFACE);
            }
            if (null == module || 0 == module.Trim().CompareTo("") || null == (tuner = (h101dispatcher)this.dispatchers[module]))
            {
                return;
            }

            HostInfo.peerName = (string)msg.getProperty(XGEN_TAG_HOSTNAME);
            HostInfo.peerAddr = (string)msg.getProperty(XGEN_TAG_HOSTADDR);

            tunerPrologue(msg);
            tunerEpilogue(msg, null, tuner.dispatch(issuer, msg));
        }