internal void ReceiveNotification(MQTSH tsh) { uint method = 0x608; this.TrEntry(method, new object[] { tsh }); try { MQNOTIFICATION notification = new MQNOTIFICATION(); notification.ReadStruct(tsh.TshBuffer, tsh.Offset); MQProxyQueue queue = this.FindProxyQueue(notification.notify.hObj); if (queue == null) { NmqiException exception = new NmqiException(base.env, -1, null, 2, 0x893, null); CommonServices.SetValidInserts(); CommonServices.ArithInsert1 = 1; CommonServices.CommentInsert1 = "Unable to find proxy queue for Hobj"; base.FFST("%Z% %W% %I% %E% %U%", "%C%", method, 1, 0x20009546, 0); throw exception; } queue.ReceiveNotification(notification); } finally { base.TrExit(method); } }
internal void AddMessage(MQTSH tsh) { uint method = 0x607; this.TrEntry(method, new object[] { tsh }); try { MQASYNC_MESSAGE async = new MQASYNC_MESSAGE(); tsh.Offset = async.ReadStruct(tsh.TshBuffer, tsh.Offset); base.TrData(method, 0, "Hobj to be removed", BitConverter.GetBytes(async.asyncMsg.hObj)); MQProxyQueue queue = this.FindProxyQueue(async.asyncMsg.hObj); if (queue == null) { NmqiException exception = new NmqiException(base.env, -1, null, 2, 0x893, null); CommonServices.SetValidInserts(); CommonServices.ArithInsert1 = 1; CommonServices.CommentInsert1 = "Unable to find proxy queue for Hobj"; base.FFST("%Z% %W% %I% %E% %U%", "%C%", method, 1, 0x20009546, 0); throw exception; } queue.AddMessage(tsh, async); } finally { base.TrExit(method); } }
public void DeleteProxyQueue(MQProxyQueue proxyQueue) { uint method = 0x606; this.TrEntry(method, new object[] { proxyQueue }); try { this.deletePQueue.Acquire(); ManagedHobj manHobj = proxyQueue.ManHobj; if (manHobj != null) { int handle = manHobj.Handle; base.TrData(method, 0, "Hobj to be removed", BitConverter.GetBytes(handle)); MQProxyQueue queue = this.proxyQueues[handle]; if (queue != proxyQueue) { CommonServices.SetValidInserts(); CommonServices.ArithInsert1 = 1; CommonServices.CommentInsert1 = "Couldn't find the ProxyQueue.."; base.FFST("%Z% %W% %I% %E% %U%", "%C%", method, 1, 0x20009546, 0); NmqiException ex = new NmqiException(base.env, -1, null, 2, 0x893, null); base.TrException(method, ex); throw ex; } this.proxyQueues.Remove(handle); } } finally { this.deletePQueue.Release(); base.TrExit(method); } }
public static byte[] StringToQmgrBytes(NmqiEnvironment env, Hconn hconn, string str, byte[] charAttrs, int offset, int length) { Encoding dotnetEncoding = MQCcsidTable.GetDotnetEncoding(hconn.Ccsid); byte[] bytes = dotnetEncoding.GetBytes(str); if (bytes.Length > length) { NmqiException exception = new NmqiException(env, -1, null, 2, 0x7d5, null); env.LastException = exception; throw exception; } if ((offset + length) > charAttrs.Length) { NmqiException exception2 = new NmqiException(env, -1, null, 2, 0x7d5, null); env.LastException = exception2; throw exception2; } for (int i = 0; i < bytes.Length; i++) { charAttrs[offset + i] = bytes[i]; } byte[] buffer2 = dotnetEncoding.GetBytes(" "); for (int j = bytes.Length; j < length; j++) { charAttrs[offset + j] = buffer2[0]; } return(bytes); }
internal MQTSH ReceiveAsyncTSH() { uint method = 0x61a; this.TrEntry(method); MQTSH result = null; try { lock (this.asyncTshLock) { while ((this.asyncTshQueue.Count == 0) && (this.asyncFailure == null)) { try { long currentTimeInMs = NmqiTools.GetCurrentTimeInMs(); int millisecondsTimeout = 10; Monitor.Wait(this.asyncTshLock, millisecondsTimeout, true); if ((NmqiTools.GetCurrentTimeInMs() >= (currentTimeInMs + millisecondsTimeout)) && !this.Connection.IsConnected) { NmqiException ex = new NmqiException(base.env, 0x23fd, null, 2, 0x7d9, null); base.TrException(method, ex); throw ex; } continue; } catch (ThreadInterruptedException exception2) { base.TrException(method, exception2); continue; } } if (this.asyncFailure != null) { this.connectionBroken = true; this.hconn.RaiseEvent(0x7d9); NmqiException exception3 = new NmqiException(base.env, -1, null, 2, 0x7d9, this.asyncFailure); base.TrException(method, exception3); throw exception3; } } result = this.asyncTshQueue.Dequeue(); } finally { base.TrExit(method, result); } return(result); }
public static int GetLength(NmqiEnvironment env, int version, int ptrSize) { switch (version) { case 1: return(GetLengthV1(ptrSize)); case 2: return(GetLengthV2(ptrSize)); } NmqiException exception = new NmqiException(env, -1, null, 2, 0x893, null); env.LastException = exception; throw exception; }
public int Write(byte[] buffer, int offset, int length) { uint method = 0x639; this.TrEntry(method); try { base.TrText(method, "Writing " + length + " bytes onto wire"); if ((this.stream == null) || ((this.client != null) && !this.client.Connected)) { base.throwNewMQException(2, 0x7d9); } if ((this.maxkeyresetcount != 0L) && (this.maxkeyresetcount < (this.currentbytescount + length))) { this.currentbytescount = 0L; if (this.stream != null) { this.stream.Close(); } if (this.client.Connected) { this.client.Close(); } this.isClosed = true; Exception nestedException = new Exception("Max keyreset count reached..breaking the connection"); NmqiException exception2 = new NmqiException(this.env, -1, new string[] { "KeyResetCount=" + this.maxkeyresetcount, "CurrentCount=" + this.currentbytescount }, 2, 0x7d9, nestedException); throw exception2; } if ((this.client != null) && this.client.Connected) { this.stream.Write(buffer, offset, length); base.TrText(method, "Current total bytes read/write on socket: " + this.currentbytescount); Interlocked.Add(ref this.currentbytescount, (long)length); } base.TrText(method, "Write onto wire complete"); } catch (Exception exception3) { base.TrException(method, exception3); throw exception3; } finally { base.TrExit(method); } return(length); }
public void DeliverException(NmqiException e, int flag, int _event) { uint method = 0x62d; this.TrEntry(method, new object[] { e, flag, _event }); try { if (this.hconn != null) { this.hconn.DeliverException(e, flag, _event); } } finally { base.TrExit(method); } }
internal void SendTSH(MQTSH tsh) { uint method = 0x61c; this.TrEntry(method, new object[] { tsh }); MQFAPConnection connection = this.Connection; try { if (this.IsEndRequested || (this.asyncFailure != null)) { NmqiException exception = new NmqiException(base.env, -1, null, 2, 0x7d9, this.asyncFailure); throw exception; } byte[] tshBuffer = tsh.TshBuffer; byte[] buffer = null; int offset = tsh.Offset; int length = tsh.Length; int maxlength = length; base.TrData(method, 0, "Data before Processed by SendExits(if no exits are defined, this is final)", tshBuffer); if ((this.exitsActive && (this.exits != null)) && this.exits.sendExitDefined) { buffer = this.exits.ProcessSendExits(ref tshBuffer, ref offset, ref length, ref maxlength); base.TrData(method, 0, "Data after processed by SendExits", tshBuffer); } else { buffer = tshBuffer; } try { this.parentConnection.RequestSendLock(); connection.Send(buffer, offset, length, tsh.SegmentType, tsh.TSHType); } finally { this.parentConnection.ReleaseSendLock(); } } finally { tsh.ParentBuffer.Free(); tsh.ParentBuffer = null; base.TrExit(method); } }
private int ReceiveBuffer() { uint method = 0x610; this.TrEntry(method); int dataAvailable = this.commsBuffer.DataAvailable; int offset = dataAvailable + this.commsBuffer.DataUsed; int result = 0; byte[] buffer = this.commsBuffer.Buffer; try { try { result = this.remoteConnection.Receive(buffer, offset, buffer.Length - offset, SocketFlags.None); this.commsBuffer.Buffer = buffer; base.TrText(method, "Number of bytes read from Socket by RcvThread = " + result); } catch (NmqiException exception) { base.TrException(method, exception); if (!this.disconnecting) { throw exception; } result = -1; } if (!this.disconnecting && (result <= 0)) { NmqiException exception2 = new NmqiException(base.env, 0x23f8, null, 2, 0x7d9, null); throw exception2; } if (result > 0) { this.commsBuffer.DataAvailable = dataAvailable + result; } } finally { base.TrExit(method, result); } return(result); }
internal void SendData(byte[] bytes, int offset, int length, byte segmentType, int tshType) { uint method = 0xb1; this.TrEntry(method, new object[] { bytes, offset, length }); MQFAPConnection connection = this.Connection; byte[] buffer = null; int maxlength = length; try { if (this.IsEndRequested || (this.asyncFailure != null)) { NmqiException exception = new NmqiException(base.env, -1, null, 2, 0x7d9, this.asyncFailure); throw exception; } base.TrData(method, 0, "Data before Processed by SendExits(if no exits are defined, this is final)", bytes); if ((this.exitsActive && (this.exits != null)) && this.exits.sendExitDefined) { buffer = this.exits.ProcessSendExits(ref bytes, ref offset, ref length, ref maxlength); base.TrData(method, 0, "Data after processed by SendExits", bytes); } else { buffer = bytes; } try { this.parentConnection.RequestSendLock(); connection.Send(buffer, offset, length, segmentType, tshType); buffer = null; } finally { this.parentConnection.ReleaseSendLock(); } } finally { base.TrExit(method); } }
public static QueueManagerInfo GetQueueManagerInfo(NmqiEnvironment env, NmqiMQ mq, Hconn hconn) { QueueManagerInfo info = env.NewQueueManagerInfo(); MQObjectDescriptor pObjDesc = env.NewMQOD(); pObjDesc.ObjectType = 5; int options = 0x20; Phobj pHobj = env.NewPhobj(); int pCompCode = 0; int pReason = 0; mq.MQOPEN(hconn, ref pObjDesc, options, pHobj, out pCompCode, out pReason); if (pReason == 0) { Hobj hOBJ = pHobj.HOBJ; int[] pSelectors = new int[] { 0x1f, 0x20, 2, 0x7df, 0x7f0 }; int[] pIntAttrs = new int[3]; byte[] pCharAttrs = new byte[0x60]; mq.MQINQ(hconn, hOBJ, pSelectors.Length, pSelectors, pIntAttrs.Length, pIntAttrs, pCharAttrs.Length, pCharAttrs, out pCompCode, out pReason); if (pReason == 0) { info.CommandLevel = pIntAttrs[0]; info.Platform = pIntAttrs[1]; info.Ccsid = pIntAttrs[2]; Encoding dotnetEncoding = MQCcsidTable.GetDotnetEncoding(info.Ccsid); info.Name = dotnetEncoding.GetString(pCharAttrs, 0, 0x30); info.Uid = dotnetEncoding.GetString(pCharAttrs, 0x30, 0x30); } else { NmqiException exception = new NmqiException(env, 0x253a, null, pCompCode, pReason, null); env.LastException = exception; throw exception; } mq.MQCLOSE(hconn, pHobj, 0, out pCompCode, out pReason); return(info); } NmqiException exception2 = new NmqiException(env, 0x2525, null, pCompCode, pReason, null); env.LastException = exception2; throw exception2; }
internal void CheckIfDisconnected() { uint method = 0x612; this.TrEntry(method); try { ManagedHconn reconnectableParent = this.ReconnectableParent; if (this.disconnected && ((reconnectableParent == null) || ((reconnectableParent != null) && reconnectableParent.HasFailed()))) { NmqiException ex = new NmqiException(base.env, -1, null, 2, 0x7d9, this.asyncFailure); base.TrException(method, ex); throw ex; } } finally { base.TrExit(method); } }
public static byte[] GetUtf8Bytes(NmqiEnvironment env, string str, string name) { if (str == null) { return(new byte[0]); } try { return(Encoding.GetEncoding("UTF-8").GetBytes(str)); } catch (IOException exception) { string[] strArray2 = new string[3]; strArray2[0] = GetExSumm(exception); strArray2[2] = exception.Source; string[] inserts = strArray2; NmqiException exception2 = new NmqiException(env, 0x254a, inserts, 2, 0x893, exception); env.LastException = exception2; throw exception2; } return(null); }
internal void DeliverExchangeReply(int requestId, MQTSH tsh) { uint method = 0x61e; this.TrEntry(method, new object[] { requestId, tsh }); try { tsh = this.ProcessReceivedData(tsh); lock (this.requestEntryMutex) { MQRequestEntry exchangeRequests = this.exchangeRequests; while ((exchangeRequests != null) && (exchangeRequests.RequestID != requestId)) { exchangeRequests = exchangeRequests.Next; } if (exchangeRequests == null) { CommonServices.SetValidInserts(); CommonServices.ArithInsert1 = (uint)requestId; CommonServices.ArithInsert2 = tsh.SegmentType; CommonServices.CommentInsert1 = "Unexpected flow received in DeliverExchangeReply"; CommonServices.CommentInsert2 = "Cached RequestEntry is null for given RequestId"; base.FFST("%Z% %W% %I% %E% %U%", "%C%", method, 1, 0x20009546, 0); NmqiException ex = new NmqiException(base.env, -1, null, 2, 0x893, null); base.TrException(method, ex); throw ex; } lock (exchangeRequests) { exchangeRequests.Reply = tsh; Monitor.Pulse(exchangeRequests); } } } finally { base.TrExit(method); } }
public MQXARecoveryBridge(ManagedHconn hconn, NmqiEnvironment env) : base(env) { this.recoveryProperties = new Hashtable(6); this.TransactionLogList = new Hashtable(10); this.recoveryQueueOpenOpts = 0x12; uint method = 0x529; this.TrEntry(method, new object[] { hconn, env }); try { base.TrConstructor("%Z% %W% %I% %E% %U%"); this.recoveryHconn = hconn; this.recoveryPutPmo = new MQPutMessageOptions(); this.recoveryPutPmo.Options = 0xc0; this.recoveryGetGmo = new MQGetMessageOptions(); this.recoveryGetGmo.MatchOptions = 1; this.recoveryGetGmo.Options = 1; this.recoveryGetGmo.WaitInterval = 0x3e8; this.InitializeTransactionRecovery(); } catch (MQException exception) { base.TrException(method, exception, 1); throw exception; } catch (Exception exception2) { base.TrException(method, exception2, 2); NmqiException exception3 = new NmqiException(env, -1, null, 2, 0x893, exception2); throw exception3; } finally { base.TrExit(method); } }
private MQProxyQueue FindProxyQueue(int clientId) { uint method = 0x604; this.TrEntry(method, new object[] { clientId }); MQProxyQueue queue = null; try { this.findingPQueue.Acquire(); try { queue = this.proxyQueues[clientId]; } catch (KeyNotFoundException) { } if (queue == null) { NmqiException ex = new NmqiException(base.env, -1, null, 2, 0x893, null); CommonServices.SetValidInserts(); CommonServices.ArithInsert1 = 1; CommonServices.CommentInsert1 = this.hconn.Session.ParentConnection.NegotiatedChannel.ChannelName.Trim(); CommonServices.CommentInsert2 = "No proxy queue with ClientId "; base.FFST("%Z% %W% %I% %E% %U%", "%C%", method, 1, 0x20009546, 0); base.TrException(method, ex); throw ex; } } finally { this.findingPQueue.Release(); base.TrExit(method); } return(queue); }
public void Run() { uint method = 0x60e; this.TrEntry(method); this.threadId = Thread.CurrentThread.GetHashCode(); string str = "RcvThread: " + this.remoteConnection.ToString(); Thread.CurrentThread.Name = str; try { int conversationID; int requestID; MQSession sessionByConvId; int segmentType; MQSOCKACT mqsockact; MQTSH rTSH = null; Label_0040: rTSH = this.ReceiveOneTSH(); if (rTSH == null) { base.TrText(method, "Null TSH is received.. breaking and disconnecting now"); return; } if (this.remoteConnection.RemoteEncoding != rTSH.Encoding) { this.remoteConnection.RemoteEncoding = rTSH.Encoding; } switch (rTSH.TSHType) { case 1: base.TrText(method, "TSHM data has been received"); conversationID = rTSH.ConversationID; requestID = rTSH.RequestID; base.TrText(method, "ConversationId = " + conversationID); base.TrText(method, "RequestId = " + requestID); sessionByConvId = this.remoteConnection.GetSessionByConvId(conversationID); if ((sessionByConvId == null) || !sessionByConvId.IsEndRequested) { break; } base.TrText(method, "Current Sessions " + sessionByConvId.ToString() + " ending.."); goto Label_0040; case 2: { if (rTSH.SegmentType != 12) { goto Label_0515; } mqsockact = new MQSOCKACT(); if ((rTSH.Encoding & 15) == 2) { goto Label_037D; } base.TrText(method, "We received BigEndian data, read it into our encoding"); byte[] dst = new byte[mqsockact.GetLength()]; Buffer.BlockCopy(rTSH.TshBuffer, rTSH.Offset, dst, 0, mqsockact.GetLength()); Array.Reverse(dst); mqsockact.ReadStruct(dst, 0); goto Label_0391; } default: { CommonServices.SetValidInserts(); CommonServices.ArithInsert1 = 1; CommonServices.CommentInsert1 = this.remoteConnection.NegotiatedChannel.ChannelName; CommonServices.CommentInsert2 = "Invalid TSH flow is received on the receiver thread"; base.FFST("%Z% %W% %I% %E% %U%", "%C%", method, 1, 0x20009213, 0); NmqiException exception7 = new NmqiException(base.env, -1, null, 2, 0x7d9, null); base.TrException(method, exception7); throw exception7; } } if (requestID == 0) { if (sessionByConvId != null) { sessionByConvId.DeliverTSH(rTSH); } else if (conversationID == 1) { this.remoteConnection.DeliverTSH(rTSH); } else { base.TrText(method, "Unknown Conversation & RequestId"); } } else { if (requestID != 1) { goto Label_0285; } if (sessionByConvId == null) { base.TrText(method, "Unknown Conversation and no existing Session could be found for it."); } else { MQProxyQueueManager proxyQueueManager; rTSH = sessionByConvId.ProcessReceivedData(rTSH); segmentType = rTSH.SegmentType; switch (segmentType) { case 13: case 15: proxyQueueManager = sessionByConvId.Hconn.ProxyQueueManager; if (proxyQueueManager == null) { NmqiException exception = new NmqiException(base.env, -1, null, 2, 0x7d9, null); CommonServices.SetValidInserts(); CommonServices.ArithInsert1 = 1; CommonServices.ArithInsert2 = (uint)segmentType; CommonServices.CommentInsert1 = "PQM couldn't be found on obtained Session for TSH flow"; base.FFST("%Z% %W% %I% %E% %U%", "%C%", method, 1, 0x20009213, 0); throw exception; } break; default: goto Label_0237; } switch (segmentType) { case 13: proxyQueueManager.AddMessage(rTSH); break; case 15: proxyQueueManager.ReceiveNotification(rTSH); break; } sessionByConvId.ReleaseReceivedTSH(rTSH); } } goto Label_0040; Label_0237: CommonServices.SetValidInserts(); CommonServices.ArithInsert1 = 1; CommonServices.ArithInsert2 = (uint)segmentType; CommonServices.CommentInsert1 = "Incorrect Segment type received on multiplexing flow"; base.FFST("%Z% %W% %I% %E% %U%", "%C%", method, 1, 0x20009213, 0); NmqiException exception2 = new NmqiException(base.env, -1, null, 2, 0x7d9, null); throw exception2; Label_0285: if ((requestID % 2) != 0) { if (sessionByConvId == null) { base.TrText(method, "Unknown Conversation and no existing Session could be found for it."); } else { sessionByConvId.DeliverExchangeReply(requestID, rTSH); } goto Label_0040; } NmqiException ex = new NmqiException(base.env, -1, null, 2, 0x893, null); CommonServices.SetValidInserts(); CommonServices.ArithInsert1 = 1; CommonServices.CommentInsert1 = this.remoteConnection.NegotiatedChannel.ChannelName; CommonServices.CommentInsert2 = "Unknown request id flow on the multiplexed connection"; base.FFST("%Z% %W% %I% %E% %U%", "%C%", method, 1, 0x20009213, 0); base.TrException(method, ex); throw ex; Label_037D: mqsockact.ReadStruct(rTSH.TshBuffer, rTSH.Offset); Label_0391: switch (mqsockact.Type) { case 1: case 4: case 5: case 6: goto Label_0040; case 2: { bool informQmgr = false; if ((rTSH.ControlFlags1 & 1) != 0) { base.TrText(method, "rfpSAT_END_CONV request with rfpTCF_CONFIRM_REQUEST received"); informQmgr = true; } int convId = mqsockact.ConversationID; MQSession session2 = this.remoteConnection.GetSessionByConvId(convId); if (session2 != null) { this.remoteConnection.RemoveSession(session2.ConversationId, informQmgr); NmqiException exception4 = new NmqiException(base.env, -1, null, 2, 0x7d9, null); base.TrException(method, exception4); session2.AsyncFailureNotify(exception4); } else if (convId == 1) { NmqiException exception5 = new NmqiException(base.env, -1, null, 2, 0x7d9, null); base.TrException(method, exception5); this.remoteConnection.AsyncFailureNotify(exception5, false); } else { base.TrData(method, 1, "hConn not recognised by connection,ConversationID ", BitConverter.GetBytes(mqsockact.ConversationID)); } goto Label_057D; } case 3: { NmqiException exception6 = new NmqiException(base.env, -1, null, 2, 0x89a, null); base.TrException(method, exception6); this.remoteConnection.AsyncFailureNotify(exception6, true); goto Label_0040; } case 7: this.remoteConnection.QmQuiescing(); goto Label_057D; case 9: switch (mqsockact.Parm1) { case 1: goto Label_0507; } goto Label_057D; default: goto Label_057D; } this.remoteConnection.NotifyReconnect(false); goto Label_057D; Label_0507: this.remoteConnection.NotifyReconnect(true); goto Label_057D; Label_0515: if ((rTSH.ControlFlags1 & 8) != 0) { this.remoteConnection.AnalyseErrorSegment(rTSH); goto Label_057D; } if (rTSH.SegmentType != 9) { goto Label_0570; } if (this.remoteConnection.FapLevel >= 10) { if ((rTSH.ControlFlags1 & 1) != 0) { goto Label_0562; } goto Label_0040; } if ((rTSH.ControlFlags1 & 1) != 0) { goto Label_0040; } Label_0562: this.remoteConnection.SendHeartbeat(2); goto Label_057D; Label_0570: if (rTSH.SegmentType == 11) { goto Label_0040; } Label_057D: this.remoteConnection.ReleaseReceivedTSH(rTSH); goto Label_0040; } catch (Exception exception8) { base.TrException(method, exception8, 1); NmqiException e = null; if (exception8 is NmqiException) { e = (NmqiException)exception8; } else if (exception8 is MQException) { e = new NmqiException(base.env, -1, null, (exception8 as MQException).CompCode, (exception8 as MQException).Reason, null); } else { int compCode = 2; int reason = 0x893; CommonServices.SetValidInserts(); CommonServices.ArithInsert1 = 1; CommonServices.CommentInsert1 = this.remoteConnection.NegotiatedChannel.ChannelName.Trim(); CommonServices.CommentInsert2 = "System Exception generated on Receiver thread - " + exception8.Message; CommonServices.CommentInsert3 = "Exception Stack - " + exception8.StackTrace; base.FFST("%Z% %W% %I% %E% %U%", "%C%", method, 1, 0x20009213, 0); e = new NmqiException(base.env, -1, null, compCode, reason, exception8); } try { if (this.remoteConnection != null) { this.remoteConnection.AsyncFailureNotify(e, false); } } catch (NmqiException exception10) { base.TrException(method, exception10, 2); } catch (Exception exception11) { base.TrException(method, exception11, 3); CommonServices.SetValidInserts(); CommonServices.ArithInsert1 = 1; CommonServices.CommentInsert1 = this.remoteConnection.NegotiatedChannel.ChannelName; CommonServices.CommentInsert2 = "System Exception generated on AsyncFailureNotify - " + exception11.Message; CommonServices.CommentInsert3 = "Exception Stack - " + exception11.StackTrace; base.FFST("%Z% %W% %I% %E% %U%", "%C%", method, 1, 0x20009213, 0); } if (!this.disconnecting) { try { if (this.remoteConnection != null) { this.remoteConnection.Disconnect(); } } catch (NmqiException exception12) { base.TrException(method, exception12, 4); } catch (Exception exception13) { base.TrException(method, exception13, 5); CommonServices.SetValidInserts(); CommonServices.ArithInsert1 = 1; CommonServices.CommentInsert1 = this.remoteConnection.NegotiatedChannel.ChannelName; CommonServices.CommentInsert2 = "System Exception generated while Disconnecting - " + exception13.Message; CommonServices.CommentInsert3 = "Exception Stack - " + exception13.StackTrace; base.FFST("%Z% %W% %I% %E% %U%", "%C%", method, 1, 0x20009213, 0); } } } finally { if (this.commsBuffer != null) { this.commsBuffer.Free(); } base.TrExit(method); } }
public void Run() { uint method = 0x3b9; this.TrEntry(method); this.threadName = "DispatchThread: [" + this.hconn + "]"; Thread.CurrentThread.Name = this.threadName; base.TrText(method, "Dispatcher's name = " + this.threadName); Thread.SetData(Thread.GetNamedDataSlot("MQ_CLIENT_THREAD_TYPE"), 2); int num2 = 0; int num3 = 0; try { this.hconn.RequestThreadLock(); this.hconn.ReleaseThreadLock(); while (!this.exitThread) { num2 = 0; this.savedDispatchSeq = this.dispatchSeq; this.noMsgsWait = 0; if (this.hconnActive) { this.hconn.RequestDispatchLock(-1); try { this.ProcessHconn(); if ((this.hconnActive && this.hconn.IsStarted()) && !this.hconn.IsSuspended()) { this.processed = 0; num3 = 0; MQProxyQueue[] getDispatchQueueList = this.hconn.GetDispatchQueueList; for (int i = 0; i < getDispatchQueueList.Length; i++) { MQProxyQueue pq = getDispatchQueueList[i]; this.waitQ = (pq.MqcbGmo.WaitInterval > 0) && ((pq.MqcbGmo.Options & 1) != 0); if (this.waitQ) { this.now = DateTime.Now.Millisecond; } IntPtr callbackFunction = pq.MqcbCBD.CallbackFunction; if ((pq.Status & 0x40000) == 0) { if (pq.EventsRaised != this.hconn.EventsHad) { pq.DriveEventsMC(); } if (!pq.IsEmpty()) { this.DeliverMsgs(pq); } else if (this.ShouldDriveNoMsgs(pq) || pq.CallbackOnEmpty()) { pq.CallConsumer(5, 2, 0x7f1); pq.UnsetCallbackOnEmpty(); } if (this.hconn.ConsumersChanged()) { this.hconn.DriveOutstanding(); } if ((pq.Status & 0x80) != 0) { if (this.processed != 0) { num3++; } } else { num3++; } if ((pq.Status & 0x80000) != 0) { this.hconn.RemoveFromDispatchList(pq); this.hconn.ProxyQueueManager.DeleteProxyQueue(pq); } } num2 += this.processed; getDispatchQueueList = this.hconn.GetDispatchQueueList; } } } finally { if (this.hconn != null) { try { this.hconn.ReleaseDispatchLock(); } catch (SynchronizationLockException) { } } } Thread.Sleep(0); } if ((num2 == 0) && (this.savedDispatchSeq == this.dispatchSeq)) { this.hconn.RequestThreadLock(); try { if (this.savedDispatchSeq != this.dispatchSeq) { continue; } this.status |= 1; } finally { this.hconn.ReleaseThreadLock(); } this.SleepPhase(); } } } catch (Exception exception) { NmqiException ex = null; if ((exception is NmqiException) || (exception is MQException)) { if (exception is MQException) { ex = new NmqiException(base.env, -1, null, ((MQException)exception).CompCode, ((MQException)exception).Reason, exception); } else { ex = (NmqiException)exception; } if (ex.Reason == 0x893) { CommonServices.SetValidInserts(); CommonServices.ArithInsert1 = 1; CommonServices.ArithInsert2 = (uint)this.status; CommonServices.CommentInsert1 = exception.Message; CommonServices.CommentInsert2 = exception.StackTrace; base.FFST("%Z% %W% %I% %E% %U%", "%C%", method, 1, 0x20009546, 0); } base.TrException(method, ex); throw ex; } CommonServices.SetValidInserts(); CommonServices.ArithInsert1 = 1; CommonServices.ArithInsert2 = (uint)this.status; CommonServices.CommentInsert1 = exception.Message; CommonServices.CommentInsert2 = exception.StackTrace; base.FFST("%Z% %W% %I% %E% %U%", "%C%", method, 1, 0x20009546, 0); base.TrException(method, exception); throw exception; } 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); }
internal MQTSH ExchangeTSH(MQTSH requestTsh) { uint method = 0x622; this.TrEntry(method, new object[] { requestTsh }); MQTSH result = null; try { MQRequestEntry entry2; if (this.disconnected) { NmqiException ex = new NmqiException(base.env, -1, null, 2, 0x7d9, this.asyncFailure); base.TrException(method, ex); this.connectionBroken = true; this.hconn.RaiseEvent(0x7d9); } MQRequestEntry entry = this.AllocateRequestEntry(); requestTsh.SetRequestId(entry.RequestID); byte[] bytes = BitConverter.GetBytes(IPAddress.NetworkToHostOrder(entry.RequestID)); for (int i = 12; i < 0x10; i++) { requestTsh.TshBuffer[i] = bytes[i - 12]; } requestTsh.ControlFlags1 = (byte)(requestTsh.ControlFlags1 | 1); this.SendData(requestTsh.TshBuffer, 0, requestTsh.Length, requestTsh.SegmentType, 1); Monitor.Enter(entry2 = entry); try { while (entry.Reply == null) { Monitor.Wait(entry, this.rmtReqEntMaxPollTime, true); if ((this.asyncFailure != null) || !this.Connection.IsConnected) { NmqiException exception2 = new NmqiException(base.env, -1, null, 2, 0x7d9, this.asyncFailure); base.TrException(method, exception2); throw exception2; } } } catch (ThreadInterruptedException exception3) { string str = "Interrupted while waiting for exchange reply"; CommonServices.SetValidInserts(); CommonServices.ArithInsert1 = (uint)this.conversationId; CommonServices.ArithInsert2 = (uint)entry.RequestID; CommonServices.CommentInsert1 = str; base.FFST("%Z% %W% %I% %E% %U%", "%C%", method, 1, 0x8e1, 0); NmqiException exception4 = new NmqiException(base.env, -1, null, 2, 0x893, exception3); base.TrException(method, exception4); throw exception4; } finally { Monitor.Exit(entry2); } result = entry.Reply; this.ReleaseRequestEntry(entry); } finally { base.TrExit(method, result); } return(result); }
internal void StartConversation() { uint method = 0x621; this.TrEntry(method); MQSOCKACT mqsockact = new MQSOCKACT(); int translength = 0x1c + mqsockact.GetLength(); bool flag = CommonServices.TraceEnabled(); MQTSH rTSH = null; try { MQTSH tsh = this.AllocateTSH(2, 12, 0, true, translength); mqsockact.Type = 1; mqsockact.ConversationID = this.conversationId; mqsockact.RequestID = 0; mqsockact.Parm1 = Thread.CurrentThread.ManagedThreadId; mqsockact.Parm2 = this.traceIdentifier; tsh.Offset = tsh.WriteStruct(tsh.TshBuffer, tsh.Offset); tsh.Offset = mqsockact.WriteStruct(tsh.TshBuffer, tsh.Offset); tsh.Offset = 0; if (flag) { base.TrAPI(method, "__________"); base.TrAPI(method, "START CONVERSATION FLOW >>"); base.TrData(method, 0, "Conversation Id", BitConverter.GetBytes(this.ConversationId)); base.TrData(method, 0, "Buffer", tsh.Offset, tsh.Length, tsh.TshBuffer); base.TrAPIOutput(method, "CompCode"); base.TrAPIOutput(method, "Reason"); } try { try { this.parentConnection.RequestSendLock(); this.Connection.SendTSH(tsh); } finally { this.parentConnection.ReleaseSendLock(); } rTSH = this.ReceiveTSH(null); if ((rTSH.ControlFlags1 & 8) != 0) { NmqiException exception = new NmqiException(base.env, -1, null, 2, 0x80b, null); base.TrException(method, exception); throw exception; } switch (rTSH.SegmentType) { case 5: if ((rTSH.ControlFlags1 & 2) != 0) { NmqiException exception2 = new NmqiException(base.env, -1, null, 2, 0x8e1, null); base.TrException(method, exception2); throw exception2; } return; case 12: mqsockact.ReadStruct(rTSH.TshBuffer, rTSH.Offset); return; } CommonServices.SetValidInserts(); CommonServices.ArithInsert1 = (uint)this.conversationId; CommonServices.ArithInsert2 = (uint)mqsockact.Type; CommonServices.CommentInsert1 = "Start Conversation Request has been refused by QMgr"; CommonServices.CommentInsert2 = "Unknown SockACT from server for START_CONV"; base.FFST("%Z% %W% %I% %E% %U%", "%C%", method, 1, 0x8e1, 0); NmqiException ex = new NmqiException(base.env, -1, null, 2, 0x8e1, null); base.TrException(method, ex); throw ex; } finally { if (flag) { base.TrAPI(method, "__________"); base.TrAPI(method, "START CONVERSATION FLOW <<"); base.TrData(method, 0, "Name", BitConverter.GetBytes(this.ConversationId)); } this.ReleaseReceivedTSH(rTSH); } } finally { base.TrExit(method); } }
private void SetValue(string rawsymbol, string value) { uint method = 0x63e; this.TrEntry(method); try { string str = rawsymbol.ToUpper(); base.TrText(method, "RawSymbol =" + str); if (str.Equals("CN")) { if (this.CN != null) { string[] inserts = new string[5]; inserts[2] = this.owningConnection.ChannelName; inserts[4] = "CN (x2)"; NmqiException ex = new NmqiException(this.env, 0x25a8, inserts, 2, 0x95f, null); base.TrException(method, ex); throw ex; } this.CN = value.ToUpper(); base.TrText(method, "CN=" + this.CN); } else if (str.Equals("T")) { if (this.T != null) { string[] strArray2 = new string[5]; strArray2[2] = this.owningConnection.ChannelName; strArray2[4] = "T (x2)"; NmqiException exception2 = new NmqiException(this.env, 0x25a8, strArray2, 2, 0x95f, null); base.TrException(method, exception2); throw exception2; } this.T = value.ToUpper(); base.TrText(method, "T=" + this.T); } else if (str.Equals("O")) { if (this.O != null) { string[] strArray3 = new string[5]; strArray3[2] = this.owningConnection.ChannelName; strArray3[4] = "O (x2)"; NmqiException exception3 = new NmqiException(this.env, 0x25a8, strArray3, 2, 0x95f, null); base.TrException(method, exception3); throw exception3; } this.O = value.ToUpper(); base.TrText(method, "O=" + this.O); } else if (str.Equals("L")) { if (this.L != null) { string[] strArray4 = new string[5]; strArray4[2] = this.owningConnection.ChannelName; strArray4[4] = "L (x2)"; NmqiException exception4 = new NmqiException(this.env, 0x25a8, strArray4, 2, 0x95f, null); base.TrException(method, exception4); throw exception4; } this.L = value.ToUpper(); base.TrText(method, "L=" + this.L); } else if ((str.Equals("ST") || str.Equals("SP")) || str.Equals("S")) { if (this.ST != null) { string[] strArray5 = new string[5]; strArray5[2] = this.owningConnection.ChannelName; strArray5[4] = str + " (x2)"; NmqiException exception5 = new NmqiException(this.env, 0x25a8, strArray5, 2, 0x95f, null); base.TrException(method, exception5); throw exception5; } this.ST = value.ToUpper(); base.TrText(method, "ST=" + this.ST); } else if (str.Equals("C")) { if (this.C != null) { string[] strArray6 = new string[5]; strArray6[2] = this.owningConnection.ChannelName; strArray6[4] = "C (x2)"; NmqiException exception6 = new NmqiException(this.env, 0x25a8, strArray6, 2, 0x95f, null); base.TrException(method, exception6); throw exception6; } this.C = value.ToUpper(); base.TrText(method, "C=" + this.C); } else if (str.Equals("SERIALNUMBER")) { if (this.SERIALNUMBER != null) { string[] strArray7 = new string[5]; strArray7[2] = this.owningConnection.ChannelName; strArray7[4] = str + " (x2)"; NmqiException exception7 = new NmqiException(this.env, 0x25a8, strArray7, 2, 0x95f, null); base.TrException(method, exception7); throw exception7; } this.SERIALNUMBER = value.ToUpper(); base.TrText(method, "SERIALNUMBER=" + this.SERIALNUMBER); } else if (str.Equals("MAIL")) { if (this.MAIL != null) { string[] strArray8 = new string[5]; strArray8[2] = this.owningConnection.ChannelName; strArray8[4] = str + " (x2)"; NmqiException exception8 = new NmqiException(this.env, 0x25a8, strArray8, 2, 0x95f, null); base.TrException(method, exception8); throw exception8; } this.MAIL = value.ToUpper(); base.TrText(method, "MAIL=" + this.MAIL); } else if (str.Equals("E")) { if (this.E != null) { string[] strArray9 = new string[5]; strArray9[2] = this.owningConnection.ChannelName; strArray9[4] = str + " (x2)"; NmqiException exception9 = new NmqiException(this.env, 0x25a8, strArray9, 2, 0x95f, null); base.TrException(method, exception9); throw exception9; } this.E = value.ToUpper(); base.TrText(method, "E=" + this.E); } else if (str.Equals("UID") || str.Equals("USERID")) { if (this.UID != null) { string[] strArray10 = new string[5]; strArray10[2] = this.owningConnection.ChannelName; strArray10[4] = str + " (x2)"; NmqiException exception10 = new NmqiException(this.env, 0x25a8, strArray10, 2, 0x95f, null); base.TrException(method, exception10); throw exception10; } this.UID = value.ToUpper(); base.TrText(method, "UID=" + this.UID); } else if (str.Equals("STREET")) { if (this.STREET != null) { string[] strArray11 = new string[5]; strArray11[2] = this.owningConnection.ChannelName; strArray11[4] = str + " (x2)"; NmqiException exception11 = new NmqiException(this.env, 0x25a8, strArray11, 2, 0x95f, null); base.TrException(method, exception11); throw exception11; } this.STREET = value.ToUpper(); base.TrText(method, "STREET=" + this.STREET); } else if (str.Equals("PC") || str.Equals("POSTALCODE")) { if (this.PC != null) { string[] strArray12 = new string[5]; strArray12[2] = this.owningConnection.ChannelName; strArray12[4] = str + " (x2)"; NmqiException exception12 = new NmqiException(this.env, 0x25a8, strArray12, 2, 0x95f, null); base.TrException(method, exception12); throw exception12; } this.PC = value.ToUpper(); base.TrText(method, "PC=" + this.PC); } else if (str.Equals("UNSTRUCTUREDNAME")) { if (this.UNSTRUCTUREDNAME != null) { string[] strArray13 = new string[5]; strArray13[2] = this.owningConnection.ChannelName; strArray13[4] = str + " (x2)"; NmqiException exception13 = new NmqiException(this.env, 0x25a8, strArray13, 2, 0x95f, null); base.TrException(method, exception13); throw exception13; } this.UNSTRUCTUREDNAME = value.ToUpper(); base.TrText(method, "UNSTRUCTUREDNAME=" + this.UNSTRUCTUREDNAME); } else if (str.Equals("UNSTRUCTUREDADDRESS")) { if (this.UNSTRUCTUREDADDRESS != null) { string[] strArray14 = new string[5]; strArray14[2] = this.owningConnection.ChannelName; strArray14[4] = str + " (x2)"; NmqiException exception14 = new NmqiException(this.env, 0x25a8, strArray14, 2, 0x95f, null); base.TrException(method, exception14); throw exception14; } this.UNSTRUCTUREDADDRESS = value.ToUpper(); base.TrText(method, "UNSTRUCTUREDADDRESS=" + this.UNSTRUCTUREDADDRESS); } else if (str.Equals("DNQ")) { if (this.DNQ != null) { string[] strArray15 = new string[5]; strArray15[2] = this.owningConnection.ChannelName; strArray15[4] = str + " (x2)"; NmqiException exception15 = new NmqiException(this.env, 0x25a8, strArray15, 2, 0x95f, null); base.TrException(method, exception15); throw exception15; } this.DNQ = value.ToUpper(); base.TrText(method, "DNQ=" + this.DNQ); } else if (str.Equals("OU")) { this.OU.Add(value.ToUpper()); base.TrText(method, "OU=" + this.OU); } else if (str.Equals("DC")) { this.DC.Add(value.ToUpper()); base.TrText(method, "OU=" + this.OU); } else if (this.matcher) { string[] strArray16 = new string[5]; strArray16[2] = this.owningConnection.ChannelName; strArray16[4] = str + " (x2)"; NmqiException exception16 = new NmqiException(this.env, 0x25a8, strArray16, 2, 0x95f, null); base.TrException(method, exception16); throw exception16; } } finally { base.TrExit(method); } }
private void ParseDN(string DN) { uint method = 0x63d; this.TrEntry(method); int dNCLEAR = DNCLEAR; string rawsymbol = ""; string str2 = ""; base.TrText(method, "DN String = " + DN); if ((DN != null) && DN.Equals("")) { dNCLEAR = DNFINISHED; base.TrText(method, "State=" + dNCLEAR); } try { for (int i = 0; i < DN.Length; i++) { char ch = DN.ToCharArray()[i]; if (dNCLEAR == DNCLEAR) { switch (ch) { case '"': case ',': case ';': case '=': { string[] inserts = new string[5]; inserts[2] = this.owningConnection.ChannelName; inserts[4] = Convert.ToString(ch); NmqiException ex = new NmqiException(this.env, 0x25a8, inserts, 2, 0x95f, null); base.TrException(method, ex); throw ex; } } if ((ch != ' ') && (ch != '\t')) { rawsymbol = rawsymbol + ch; dNCLEAR = DNSYMBOL; base.TrText(method, "State=" + dNCLEAR); } } else if (dNCLEAR == DNSYMBOL) { switch (ch) { case ' ': case '"': { string[] strArray2 = new string[5]; strArray2[2] = this.owningConnection.ChannelName; strArray2[4] = Convert.ToString(ch); NmqiException exception2 = new NmqiException(this.env, 0x25a8, strArray2, 2, 0x95f, null); base.TrException(method, exception2); throw exception2; } } if (ch == '=') { str2 = ""; if ((i + 1) >= DN.Length) { dNCLEAR = DNVALUE; base.TrText(method, "State=" + dNCLEAR); } else if (DN.ToCharArray()[i + 1] == '"') { i++; dNCLEAR = DNQVALUE; base.TrText(method, "State=" + dNCLEAR); } else { dNCLEAR = DNVALUE; base.TrText(method, "State=" + dNCLEAR); } } else { rawsymbol = rawsymbol + ch; } } else if (dNCLEAR == DNVALUE) { if (((ch == ',') || (ch == ';')) && ((i == 0) || (DN.ToCharArray()[i - 1] != '\\'))) { dNCLEAR = DNCLEAR; base.TrText(method, "State=" + dNCLEAR); this.SetValue(rawsymbol, str2.Trim()); rawsymbol = ""; } else { str2 = str2 + ch; base.TrText(method, "State=" + dNCLEAR); } } else if (dNCLEAR == DNQVALUE) { if ((ch == '"') && ((i == 0) || (DN.ToCharArray()[i - 1] != '\\'))) { dNCLEAR = DNFINISHED; base.TrText(method, "State=" + dNCLEAR); this.SetValue(rawsymbol, str2); rawsymbol = ""; } else { str2 = str2 + ch; } } else if (dNCLEAR == DNFINISHED) { if ((ch == ',') || (ch == ';')) { dNCLEAR = DNCLEAR; base.TrText(method, "State=" + dNCLEAR); } else if ((ch != ' ') && (ch != '\t')) { string[] strArray3 = new string[5]; strArray3[2] = this.owningConnection.ChannelName; strArray3[4] = Convert.ToString(ch); NmqiException exception3 = new NmqiException(this.env, 0x25a8, strArray3, 2, 0x95f, null); base.TrException(method, exception3); throw exception3; } } } if (dNCLEAR == DNVALUE) { base.TrText(method, "State=" + dNCLEAR); this.SetValue(rawsymbol, str2.Trim()); } if ((dNCLEAR == DNSYMBOL) || (dNCLEAR == DNCLEAR)) { string[] strArray4 = new string[5]; strArray4[2] = this.owningConnection.ChannelName; strArray4[4] = rawsymbol; NmqiException exception4 = new NmqiException(this.env, 0x25a8, strArray4, 2, 0x95f, null); base.TrException(method, exception4); throw exception4; } } catch (MQException exception5) { base.TrException(method, exception5); throw exception5; } finally { base.TrExit(method); } }