public MQConnectionSecurityParameters NewMQCSP()
        {
            uint method = 0x2e5;

            this.TrEntry(method);
            MQConnectionSecurityParameters result = new MQConnectionSecurityParameters();

            base.TrExit(method, result);
            return(result);
        }
Beispiel #2
0
        internal void InitOAMFlow(MQConnectionSecurityParameters mqcsp)
        {
            uint method = 0x62b;

            this.TrEntry(method, new object[] { mqcsp });
            try
            {
                this.parentConnection.InitOAMFlow(mqcsp, this);
            }
            finally
            {
                base.TrExit(method);
            }
        }
        private MQFAPConnection CreateAndConnectConnection(MQChannelDefinition mqcd, MQSSLConfigOptions sslConfigOptions, MQConnectionSecurityParameters mqcsp, MQFAP fap, string qMgrName, int connectOptions, int maxFapLevel)
        {
            MQFAPConnection connection;
            uint            method = 0x59a;

            this.TrEntry(method, new object[] { mqcsp, fap, qMgrName, connectOptions, maxFapLevel });
            try
            {
                if (mqcd == null)
                {
                    CommonServices.SetValidInserts();
                    CommonServices.CommentInsert1 = "No Channel Definition to establish connection";
                    base.FFST("%Z% %W% %I% %E% %U%", "%C%", method, 1, 0x20009519, 0);
                    NmqiException exception = new NmqiException(base.env, -1, null, 2, 0x893, null);
                    throw exception;
                }
                if (mqcd.TransportType == 2)
                {
                    connection = new MQTCPConnection(base.env, this, fap, mqcd, sslConfigOptions, this.GetConnectOptions(connectOptions));
                }
                else
                {
                    string[] inserts = new string[3];
                    inserts[2] = mqcd.TransportType.ToString();
                    NmqiException exception2 = new NmqiException(base.env, 0x26bb, inserts, 2, 0x80b, null);
                    throw exception2;
                }
                this.connectionsLock.Acquire();
                this.connectingConnections++;
                try
                {
                    MQChannelDefinition definition = connection.ClientConn.Clone();
                    definition.Version           = 11;
                    connection.NegotiatedChannel = definition;
                }
                catch (Exception exception3)
                {
                    base.TrException(method, exception3, 1);
                    NmqiException exception4 = new NmqiException(base.env, -1, null, 2, 0x8e5, null);
                    throw exception4;
                }
                connection.InitSecurityExits();
                try
                {
                    connection.Connect(mqcsp);
                }
                catch (Exception exception5)
                {
                    base.TrException(method, exception5, 2);
                    connection = null;
                    throw exception5;
                }
            }
            finally
            {
                this.connectingConnections--;
                this.connectionsLock.Release();
                this.connectionsLock.PulseAll();
                base.TrExit(method);
            }
            return(connection);
        }
        private MQSession GetSessionFromNewConnection(MQChannelDefinition mqcd, MQSSLConfigOptions sslConfigOptions, MQConnectionSecurityParameters mqcsp, MQFAP fap, string qMgrName, int connectOptions, int maxFapLevel)
        {
            uint method = 0x599;

            this.TrEntry(method, new object[] { mqcsp, fap, qMgrName, connectOptions, maxFapLevel });
            MQFAPConnection connection = null;
            MQSession       session    = null;

            try
            {
                this.connectionsLock.Acquire();
                connection = this.CreateAndConnectConnection(mqcd, sslConfigOptions, mqcsp, fap, qMgrName, connectOptions, maxFapLevel);
                session    = connection.AssignSession();
                session.ParentConnection = connection;
                session.InitSendReceiveExits(true);
                if (connection.GetFreeConversations() > 0)
                {
                    this.AddConnection(connection);
                }
            }
            finally
            {
                this.connectionsLock.Release();
                base.TrExit(method);
            }
            return(session);
        }
        internal MQSession GetSession(MQChannelDefinition mqcd, MQSSLConfigOptions sslConfigOptions, MQConnectionSecurityParameters mqcsp, MQFAP fap, string qMgrName, int connectOptions, int maxFAPLevel)
        {
            uint method = 0x598;

            this.TrEntry(method, new object[] { mqcsp, fap, qMgrName, connectOptions, maxFAPLevel });
            MQSession result = null;
            bool      flag   = CommonServices.TraceEnabled();

            try
            {
                int num2 = 0;
                for (num2 = 0; (num2 < 3) && (result == null); num2++)
                {
                    result = this.GetSessionFromEligibleConnection();
                    if ((result != null) && flag)
                    {
                        base.TrText(method, string.Concat(new object[] { "Current session(existing connection) = ", result.ConversationId, "Connection - ", result.Connection.GetHashCode() }));
                    }
                }
                if (result == null)
                {
                    result = this.GetSessionFromNewConnection(mqcd, sslConfigOptions, mqcsp, fap, qMgrName, connectOptions, maxFAPLevel);
                    if ((result != null) && flag)
                    {
                        base.TrText(method, string.Concat(new object[] { "Current session(existing connection) = ", result.ConversationId, "Connection - ", result.Connection.GetHashCode() }));
                    }
                }
                result.InitOAMFlow(mqcsp);
            }
            finally
            {
                base.TrExit(method, result);
            }
            return(result);
        }
Beispiel #6
0
        public MQSession GetSession(int connectOptions, MQSSLConfigOptions sslConfigOptions, MQConnectionSecurityParameters mqcsp, MQChannelDefinition mqcd, string qMgrName, int nmqiFlags, string uidFlowUserid, string uidFlowPassword, int ccsid, int maxFapLevel)
        {
            uint method = 0x5e7;

            this.TrEntry(method, new object[] { connectOptions, mqcsp, mqcd, qMgrName, nmqiFlags, uidFlowUserid, (uidFlowPassword == null) ? uidFlowPassword : "******", ccsid, maxFapLevel });
            MQSession session = null;

            try
            {
                MQConnectionSpecification specification = new MQConnectionSpecification(base.env, this, mqcd, sslConfigOptions, nmqiFlags, uidFlowUserid, uidFlowPassword, ccsid);
                try
                {
                    this.callSync.Acquire();
                    object obj2 = null;
                    foreach (object obj3 in this.allConnectionSpecs.Keys)
                    {
                        MQConnectionSpecification specification2 = (MQConnectionSpecification)obj3;
                        if (specification2.Equals(specification))
                        {
                            specification = specification2;
                            obj2          = specification2;
                            base.TrText(method, "Found a matching connection spec..");
                            break;
                        }
                    }
                    if (obj2 == null)
                    {
                        base.TrText(method, "Couldnt find a matching connection spec. Adding new one into table");
                        this.allConnectionSpecs.Add(specification, specification);
                    }
                }
                finally
                {
                    this.callSync.Release();
                }
                session = specification.GetSession(mqcd, sslConfigOptions, mqcsp, this.fap, qMgrName, connectOptions, maxFapLevel);
                try
                {
                    this.callSync.Acquire();
                    if (!this.allConnectionSpecs.ContainsKey(specification))
                    {
                        this.allConnectionSpecs.Add(specification, specification);
                    }
                }
                finally
                {
                    this.callSync.Release();
                }
            }
            finally
            {
                base.TrExit(method);
            }
            return(session);
        }