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); }
public MQSSLConfigOptions NewMQSCO() { uint method = 0x3d0; this.TrEntry(method); MQSSLConfigOptions result = new MQSSLConfigOptions(); base.TrExit(method, result); return(result); }
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); }
internal MQConnectionSpecification(NmqiEnvironment nmqiEnv, MQFAPConnectionPool mqConnectionPool, MQChannelDefinition mqcd, MQSSLConfigOptions sslConfigOptions, int nmqiFlags, string uidFlowUserId, string uidFlowPassword, int ccsid) : base(nmqiEnv) { this.connectionsLock = new Lock(); this.eligibleConnections = new ArrayList(); base.TrConstructor("%Z% %W% %I% %E% %U%", new object[] { nmqiEnv, mqConnectionPool, mqcd, nmqiFlags, uidFlowUserId, (uidFlowPassword == null) ? uidFlowPassword : "******", ccsid }); this.connectionPool = mqConnectionPool; this.mqcd = mqcd; this.mqsco = sslConfigOptions; this.nmqiFlags = nmqiFlags; this.uidFlowUserId = uidFlowUserId; this.uidFlowPassword = uidFlowPassword; this.ccsid = ccsid; }
private void RetrieveAndValidateSSLParams(MQChannelDefinition mqcd, MQSSLConfigOptions sslConfigOptions) { uint method = 0x637; this.TrEntry(method); try { if (sslConfigOptions != null) { this.keyStore = sslConfigOptions.KeyRepository; if ((this.keyStore == null) || ((this.keyStore != "*SYSTEM") && (this.keyStore != "*USER"))) { base.throwNewMQException(2, 0x94d); } base.TrText(method, "KeyStore is " + this.keyStore); string str = base.GetString(sslConfigOptions.CerfificateLabel); if ((str != null) & (str != "")) { this.clientCertName = str; } this.maxkeyresetcount = sslConfigOptions.KeyResetCount; base.TrText(method, "KeyResetCount is " + this.maxkeyresetcount); this.sslCertRevocationCheck = sslConfigOptions.CertRevocationCheck; base.TrText(method, "CertificationCheck = " + Convert.ToString(this.sslCertRevocationCheck)); if (mqcd != null) { this.cipherSpec = mqcd.SSLCipherSpec; base.TrText(method, "CipherSpec value is " + this.cipherSpec); this.sslPeerName = mqcd.SSLPeerName; base.TrText(method, "SSLPEERNAME value is " + this.sslPeerName); if (this.sslPeerName == null) { base.throwNewMQException(2, 0x95f); } } } } 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); }
public MQEncryptedSocket(NmqiEnvironment env, MQTCPConnection conn, Socket socket, MQChannelDefinition mqcd, MQSSLConfigOptions sslConfigOptions) : base(env) { this.keyStore = "*SYSTEM"; this.sslProtocol = SslProtocols.Tls; try { base.TrConstructor("%Z% %W% %I% %E% %U%"); this.env = env; this.owningConnection = conn; this.clientCertName = "ibmwebspheremq" + Environment.UserName.ToLower(); this.RetrieveAndValidateSSLParams(mqcd, sslConfigOptions); this.client = new TcpClient(); this.client.Client = socket; this.MakeSecuredConnection(); } catch (Exception) { throw; } }