public byte[] ProcessSendExits(ref byte[] input, ref int offset, ref int length, ref int maxlength)
        {
            uint method = 0x22;

            this.TrEntry(method, new object[] { input, (int)offset, (int)length, (int)maxlength });
            bool securityRequired = false;

            byte[]        buffer = input;
            MQChannelExit ep     = new MQChannelExit();

            if (this.fapConnection.IsMultiplexingEnabled)
            {
                ep.SharingConversations = true;
            }
            else
            {
                ep.SharingConversations = false;
            }
            try
            {
                if (this.SendExit != null)
                {
                    buffer = this.InvokeExits(14, ep, this.SendExit, input, ref offset, ref length, ref maxlength, ref securityRequired);
                }
            }
            finally
            {
                base.TrExit(method);
            }
            return(buffer);
        }
        public void TermExits()
        {
            uint method = 0x24;

            this.TrEntry(method);
            byte[]        inb              = null;
            int           bufferOffset     = 0;
            int           bufferLength     = 0;
            int           bufferMaxLength  = 0;
            bool          securityRequired = false;
            MQChannelExit ep = new MQChannelExit();

            try
            {
                if (this.SecurityExit != null)
                {
                    this.InvokeExits(12, ep, this.SecurityExit, inb, ref bufferOffset, ref bufferLength, ref bufferMaxLength, ref securityRequired);
                }
                if (this.SendExit != null)
                {
                    this.InvokeExits(12, ep, this.SendExit, inb, ref bufferOffset, ref bufferLength, ref bufferMaxLength, ref securityRequired);
                }
                if (this.ReceiveExit != null)
                {
                    this.InvokeExits(12, ep, this.ReceiveExit, inb, ref bufferOffset, ref bufferLength, ref bufferMaxLength, ref securityRequired);
                }
            }
            finally
            {
                base.TrExit(method);
            }
        }
        public byte[] ProcessSecurity(ref byte[] input, ref int offset, ref int length, ref int maxlength, ref bool securityRequired)
        {
            uint method = 0x21;

            this.TrEntry(method, new object[] { input, (int)offset, (int)length, (int)maxlength, (bool)securityRequired });
            byte[]        buffer = null;
            MQChannelExit ep     = new MQChannelExit();

            ep.SharingConversations = false;
            try
            {
                if (this.SecurityExit != null)
                {
                    buffer = this.InvokeExits(15, ep, this.SecurityExit, input, ref offset, ref length, ref maxlength, ref securityRequired);
                }
            }
            finally
            {
                base.TrExit(method);
            }
            return(buffer);
        }
        public byte[] InitSecurity(ref int offset, ref int length, ref int maxlength, ref bool securityRequired)
        {
            uint method = 0x20;

            this.TrEntry(method, new object[] { (int)offset, (int)length, (int)maxlength, (bool)securityRequired });
            byte[]        inb = null;
            MQChannelExit ep  = new MQChannelExit();

            ep.SharingConversations = false;
            try
            {
                if (this.SecurityExit != null)
                {
                    inb = this.InvokeExits(0x10, ep, this.SecurityExit, inb, ref offset, ref length, ref maxlength, ref securityRequired);
                }
            }
            finally
            {
                base.TrExit(method);
            }
            return(inb);
        }
        public byte[] ProcessSecurityParms(MQConnectionSecurityParameters mqcsp, ref byte[] input, ref int offset, ref int length, ref int maxlength, ref bool securityRequired)
        {
            uint method = 0x496;

            this.TrEntry(method, new object[] { mqcsp, input, (int)offset, (int)length, (int)maxlength, (bool)securityRequired });
            byte[]        buffer = null;
            MQChannelExit ep     = new MQChannelExit();

            ep.SecurityParms = mqcsp;
            try
            {
                if (this.SecurityExit != null)
                {
                    buffer = this.InvokeExits(0x1d, ep, this.SecurityExit, input, ref offset, ref length, ref maxlength, ref securityRequired);
                    mqcsp  = ep.SecurityParms;
                }
            }
            finally
            {
                base.TrExit(method);
            }
            return(buffer);
        }
        public void InitializeExits(int exitType, bool firstConv)
        {
            uint method = 0x1f;

            this.TrEntry(method, new object[] { exitType, firstConv });
            byte[]        inb              = null;
            int           bufferOffset     = 0;
            int           bufferLength     = 0;
            int           bufferMaxLength  = 0;
            bool          securityRequired = false;
            MQChannelExit ep = new MQChannelExit();

            if (firstConv)
            {
                ep.SharingConversations = false;
            }
            else
            {
                ep.SharingConversations = true;
            }
            try
            {
                string[] sendExits;
                string   securityExit;
                int      num5;
                if (this.negotiateCD == null)
                {
                    this.negotiateCD = this.fapConnection.NegotiatedChannel;
                }
                switch (exitType)
                {
                case 11:
                    securityExit = this.negotiateCD.SecurityExit;
                    if ((securityExit != null) && (securityExit.Length != 0))
                    {
                        this.SecurityExit[0].userData = this.negotiateCD.SecurityUserData;
                        this.LoadExit(ref this.SecurityExit[0]);
                        this.InvokeExits(11, ep, this.SecurityExit, inb, ref bufferOffset, ref bufferLength, ref bufferMaxLength, ref securityRequired);
                    }
                    return;

                case 13:
                    sendExits    = this.negotiateCD.SendExits;
                    securityExit = this.negotiateCD.SendExit;
                    if ((sendExits == null) || (sendExits.Length == 0))
                    {
                        goto Label_0160;
                    }
                    num5 = 0;
                    goto Label_0157;

                case 14:
                    sendExits    = this.negotiateCD.ReceiveExits;
                    securityExit = this.negotiateCD.ReceiveExit;
                    if ((sendExits == null) || (sendExits.Length == 0))
                    {
                        goto Label_0256;
                    }
                    num5 = 0;
                    goto Label_024D;

                default:
                    throw new MQManagedClientException("Unsupported exit type " + exitType, 2, 0x893);
                }
Label_0118:
                if ((this.negotiateCD.SendUserDatas != null) && (this.negotiateCD.SendUserDatas.Length > 1))
                {
                    this.SendExit[num5].userData = this.negotiateCD.SendUserDatas[num5];
                }
                num5++;
Label_0157:
                if (num5 < sendExits.Length)
                {
                    goto Label_0118;
                }
                goto Label_01AC;
Label_0160:
                if (((securityExit != null) && (securityExit != "")) && ((this.negotiateCD.SendUserData != null) && (this.negotiateCD.SendUserData != "")))
                {
                    this.SendExit[0].userData = this.negotiateCD.SendUserData;
                }
Label_01AC:
                if (((sendExits != null) && (sendExits.Length != 0)) || ((securityExit != null) && (securityExit != "")))
                {
                    this.InvokeExits(11, ep, this.SendExit, inb, ref bufferOffset, ref bufferLength, ref bufferMaxLength, ref securityRequired);
                }
                return;

Label_020E:
                if ((this.negotiateCD.ReceiveUserDatas != null) && (this.negotiateCD.ReceiveUserDatas.Length > 1))
                {
                    this.ReceiveExit[num5].userData = this.negotiateCD.ReceiveUserDatas[num5];
                }
                num5++;
Label_024D:
                if (num5 < sendExits.Length)
                {
                    goto Label_020E;
                }
                goto Label_029D;
Label_0256:
                if (((securityExit != null) && (securityExit.Length != 0)) && ((this.negotiateCD.ReceiveUserData != null) && (this.negotiateCD.ReceiveUserData != "")))
                {
                    this.ReceiveExit[0].userData = this.negotiateCD.ReceiveUserData;
                }
Label_029D:
                if (((sendExits != null) && (sendExits.Length != 0)) || ((securityExit != null) && (securityExit != "")))
                {
                    this.InvokeExits(11, ep, this.ReceiveExit, inb, ref bufferOffset, ref bufferLength, ref bufferMaxLength, ref securityRequired);
                }
            }
            finally
            {
                base.TrExit(method);
            }
        }
        public byte[] InvokeExits(int exitReason, MQChannelExit ep, ExitInstance[] ei, byte[] inb, ref int bufferOffset, ref int bufferLength, ref int bufferMaxLength, ref bool securityRequired)
        {
            uint method = 0x1d;

            this.TrEntry(method, new object[] { exitReason, ep, ei, inb, (int)bufferOffset, (int)bufferLength, (int)bufferMaxLength, (bool)securityRequired });
            byte[] dataBuffer          = inb;
            byte[] buffer2             = null;
            int    length              = ei.Length;
            int    index               = 0;
            bool   flag                = false;
            int    maxTransmissionSize = this.fapConnection.MaxTransmissionSize;

            CallContext.SetData("inExit", true);
            try
            {
                securityRequired = false;
                ep.ExitReason    = exitReason;
                ep.FapLevel      = this.fapConnection.FapLevel;
                for (index = 0; index < length; index++)
                {
                    ep.ExitID       = ei[index].exitID;
                    ep.ExitResponse = 0;
                    ep.ExitNumber   = index;
                    ep.UserData     = ei[index].userData;
                    ep.ExitUserArea = ei[index].exitUserArea;
                    try
                    {
                        if (ei[index].loaded && (!ei[index].suppressed || ((exitReason == 12) && ei[index].initialised)))
                        {
                            switch (ei[index].exitID)
                            {
                            case 11:
                                maxTransmissionSize = this.fapConnection.MaxTransmissionSize - 0x20;
                                ep.MaxSegmentLength = maxTransmissionSize;
                                buffer2             = ((MQSecurityExit)ei[index].Method).SecurityExit(ep, this.cd, dataBuffer, ref bufferOffset, ref bufferLength, ref bufferMaxLength);
                                if (buffer2 != null)
                                {
                                    switch (ep.ExitResponse)
                                    {
                                    }
                                    buffer2 = null;
                                }
                                break;

                            case 13:
                                maxTransmissionSize = this.fapConnection.MaxTransmissionSize;
                                ep.MaxSegmentLength = maxTransmissionSize;
                                buffer2             = ((MQSendExit)ei[index].Method).SendExit(ep, this.cd, dataBuffer, ref bufferOffset, ref bufferLength, ref bufferMaxLength);
                                break;

                            case 14:
                                maxTransmissionSize = this.fapConnection.MaxTransmissionSize;
                                ep.MaxSegmentLength = maxTransmissionSize;
                                buffer2             = ((MQReceiveExit)ei[index].Method).ReceiveExit(ep, this.cd, dataBuffer, ref bufferOffset, ref bufferLength, ref bufferMaxLength);
                                break;

                            default:
                                throw new MQManagedClientException("Unsupported exit type " + ei[index].exitID, 2, 0x893);
                            }
                            ei[index].exitUserArea = ep.ExitUserArea;
                            dataBuffer             = buffer2;
                            if (exitReason == 11)
                            {
                                ei[index].initialised = true;
                                if (ep.FapLevel < this.fapConnection.FapLevel)
                                {
                                    this.fapConnection.FapLevel = (byte)ep.FapLevel;
                                }
                            }
                        }
                        switch (ep.ExitResponse)
                        {
                        case -8:
                        case -6:
                        case -2:
                        case -1:
                            if (ep.ExitResponse == -6)
                            {
                                this.fapConnection.Disconnect();
                            }
                            throw new MQManagedClientException(0x20009536, 0, 0, this.cd.ChannelName, ei[index].exitName, "", 2, 0x9e9);

                        case -5:
                            ei[index].suppressed = true;
                            break;

                        case -4:
                        case 0:
                            break;

                        case -3:
                            securityRequired = true;
                            break;

                        default:
                            CommonServices.SetValidInserts();
                            CommonServices.ArithInsert1   = (uint)ep.ExitResponse;
                            CommonServices.ArithInsert2   = 0;
                            CommonServices.CommentInsert1 = ei[index].exitName;
                            CommonServices.CommentInsert2 = "";
                            CommonServices.CommentInsert3 = "";
                            base.DisplayMessage(0x20009181, 0xf0000010);
                            flag = true;
                            break;
                        }
                        if (((buffer2 != null) && (bufferOffset < 0)) || ((bufferLength < 0) || (bufferMaxLength < 0)))
                        {
                            CommonServices.SetValidInserts();
                            CommonServices.ArithInsert1   = (uint)bufferLength;
                            CommonServices.ArithInsert2   = 0;
                            CommonServices.CommentInsert1 = ei[index].exitName;
                            CommonServices.CommentInsert2 = "";
                            CommonServices.CommentInsert3 = "";
                            base.DisplayMessage(0x20009189, 0xf0000010);
                            flag = true;
                        }
                        if ((buffer2 != null) && ((bufferOffset + bufferLength) > buffer2.Length))
                        {
                            CommonServices.SetValidInserts();
                            CommonServices.ArithInsert1   = (uint)bufferLength;
                            CommonServices.ArithInsert2   = 0;
                            CommonServices.CommentInsert1 = ei[index].exitName;
                            CommonServices.CommentInsert2 = "";
                            CommonServices.CommentInsert3 = "";
                            base.DisplayMessage(0x20009197, 0xf0000010);
                            flag = true;
                        }
                        if ((buffer2 != null) && (bufferLength > maxTransmissionSize))
                        {
                            CommonServices.SetValidInserts();
                            CommonServices.ArithInsert1   = (uint)bufferLength;
                            CommonServices.ArithInsert2   = (uint)maxTransmissionSize;
                            CommonServices.CommentInsert1 = ei[index].exitName;
                            CommonServices.CommentInsert2 = "";
                            CommonServices.CommentInsert3 = "";
                            base.DisplayMessage(0x20009195, 0xf0000010);
                            flag = true;
                        }
                    }
                    catch (MQManagedClientException)
                    {
                        throw;
                    }
                    catch (Exception exception)
                    {
                        base.TrException(method, exception, 1);
                        base.FFST("%Z% %W%  %I% %E% %U%", "%C%", method, 1, 0x20009190, 0);
                        flag = true;
                    }
                    if (flag)
                    {
                        throw new MQManagedClientException(0x20009190, (uint)ep.ExitID, (uint)ep.ExitReason, ei[index].exitName, this.cd.ChannelName, "", 2, 0x893);
                    }
                }
            }
            finally
            {
                CallContext.SetData("inExit", false);
                base.TrExit(method);
            }
            return(buffer2);
        }