internal void SetUser(string user, string domain) { uint method = 0x2df; this.TrEntry(method, new object[] { user, domain }); byte[] userSID = CommonServices.GetUserSID(user, domain); base.GetBytesRightPad(user.ToUpper(), ref this.uid.UserIdentifier); base.GetBytesRightPad(user, ref this.uid.LongUserId); base.GetBytesRightPad(string.Empty, ref this.uid.Password); if ((userSID != null) && (userSID.Length <= 0x26)) { this.uid.UserSecurityId[0] = Convert.ToByte((int)(userSID.Length + 1)); this.uid.UserSecurityId[1] = 1; Buffer.BlockCopy(userSID, 0, this.uid.UserSecurityId, 2, userSID.Length); } base.TrExit(method); }
private unsafe bool Initialize() { int *ppTraceStatus = null; this.inserts = new xcsINSERTS(); this.ClearInserts(); uint num = xcsDNInitTerm(1, msdnetDump, ref ppTraceStatus); lock (typeof(MQCommonServices)) { if (pTraceStatus == null) { pTraceStatus = ppTraceStatus; if (pTraceStatus == null) { //int* numPtr2 = (int*) stackalloc byte[(((IntPtr) 1) * 4)]; 吴冬 2016-6-22 int *numPtr2 = stackalloc int[1]; numPtr2[0] = -1; pTraceStatus = numPtr2; } workPath = CommonServices.GetMQIniAttribute("WorkPath"); if ((workPath != null) && !workPath.EndsWith(@"\")) { workPath = workPath + @"\"; } else { workPath = string.Empty; } try { processPath = Application.ExecutablePath; } catch { } if (processPath == null) { processPath = "Unknown"; } } } return(0 == num); }
internal MQManagedClientException(uint returncode, uint arith1, uint arith2, string comment1, string comment2, string comment3, int compCode, int reason) : base(compCode, reason) { CommonServices.SetValidInserts(); CommonServices.ArithInsert1 = arith1; CommonServices.ArithInsert2 = arith2; if (comment1 != null) { CommonServices.CommentInsert1 = comment1; } if (comment2 != null) { CommonServices.CommentInsert2 = comment2; } if (comment3 != null) { CommonServices.CommentInsert3 = comment3; } CommonServices.GetMessage(returncode, 6, out this.explanation); CommonServices.DisplayMessage(string.Empty, null, returncode, 0xf0000010); }
internal static string GetBindingTypeFromProperties(Hashtable properties) { string str = null; string str2 = GetStringProperty("transport", properties, null); switch (str2) { case "SERVER": case "MQSeries Bindings": str = "SERVER"; break; case "CLIENT": case "MQSeries Client": str = "CLIENT"; break; case "XACLIENT": case "MQSeries XA Client": str = "XACLIENT"; break; case "MANAGEDCLIENT": case "MQSeries Managed Client": str = "MANAGEDCLIENT"; break; case null: return(str); default: str = null; break; } if (str != null) { CommonServices.TraceText("BindingType from property (" + str2 + ")"); } return(str); }
internal static string GetBindingTypeFromEnv() { string str = null; string propertyValue = CommonServices.GetPropertyValue("NMQ_MQ_LIB"); if (propertyValue != null) { switch (propertyValue.ToLower()) { case "mqm.dll": str = "SERVER"; goto Label_00D5; case "mqic32.dll": case "mqic.dll": str = "CLIENT"; goto Label_00D5; case "mqic32xa.dll": case "mqicxa.dll": str = "XACLIENT"; goto Label_00D5; case "managed": str = "MANAGEDCLIENT"; goto Label_00D5; } str = "CLIENT"; } Label_00D5: if (str != null) { CommonServices.TraceText("BindingType from NMQ_MQ_LIB"); } return(str); }
private void FindClientIni() { uint method = 0x3b; this.TrEntry(method); try { string environmentVariable = Environment.GetEnvironmentVariable(ENV_MQCLNTCF.name); if ((environmentVariable != null) && (environmentVariable.Length > 0)) { try { base.TrText("MQCLNTCF = " + environmentVariable); try { this.iniConnection = WebRequest.Create(environmentVariable).GetResponse(); this.iniStream = this.iniConnection.GetResponseStream(); } catch (UriFormatException exception) { base.TrException(method, exception); this.iniStream = System.IO.File.Open(environmentVariable, FileMode.Open, FileAccess.Read); } } catch (Exception exception2) { base.TrException(method, exception2); } } if (this.iniStream == null) { try { this.iniStream = System.IO.File.Open("mqclient.ini", FileMode.Open, FileAccess.Read); if (this.iniStream != null) { base.TrText("mqclient.ini in working directory"); } } catch (Exception exception3) { base.TrText("mqclient.ini not in working directory"); base.TrException(method, exception3); } } if (this.iniStream == null) { string path = null; try { path = CommonServices.GetMQIniAttribute("WorkPath"); } catch (Exception exception4) { base.TrException(method, exception4); } if (path != null) { try { path = path + @"\mqclient.ini"; this.iniStream = System.IO.File.Open(path, FileMode.Open, FileAccess.Read); if (this.iniStream != null) { base.TrText("mqclient.ini in WMQ data directory: " + path); } } catch (Exception exception5) { base.TrException(method, exception5); base.TrText("mqclient.ini not in WMQ data directory: " + path); } } } if (this.iniStream == null) { string str3 = Environment.GetEnvironmentVariable("HOMEDRIVE"); string str4 = Environment.GetEnvironmentVariable("HOMEPATH"); string str5 = str3 + str4 + @"\mqclient.ini"; if ((str4 != null) && (str3 != null)) { try { this.iniStream = System.IO.File.Open(str5, FileMode.Open, FileAccess.Read); if (this.iniStream != null) { base.TrText("mqclient.ini in home directory: " + str5); } } catch (Exception exception6) { base.TrException(method, exception6); base.TrText("mqclient.ini not in home directory: " + str5); } } } } finally { base.TrExit(method); } }
public MQException(int compCode, int reason, Exception innerException) : base(CommonServices.ReasonCodeName(reason), innerException) { this.compCode = compCode; this.reason = reason; CommonServices.TraceText("MQException CompCode: " + compCode.ToString() + " Reason: " + reason.ToString()); }
internal byte[][] GetTags(int requestedNumber, MQSession remoteSession) { uint method = 0; bool flag = CommonServices.TraceStatus(); byte[][] bufferArray = new byte[requestedNumber][]; int cc = 0; int rc = 0; try { int num10; int num11; int num12; int num13; int num14; MQSPI mqspi = null; MQSPIReserveInOut @out = null; int version = 1; MQSPIReserveIn @in = null; int num5 = 1; MQSPIReserveOut out2 = null; int num6 = 1; MQTSH tsh = null; MQTSH rTSH = null; int offset = remoteSession.IsMultiplexingEnabled ? 0x24 : 0x1c; MQAPI mqapi = new MQAPI(); mqapi.GetLength(); int num9 = num10 = num11 = num12 = num13 = num14 = 0; cc = 2; rc = 0x893; for (int i = 0; i < requestedNumber; i++) { bufferArray[i] = new byte[this.tagSize]; if (this.indexIssued >= this.maxIndex) { base.TrText("Requesting Server for Tag Reservation"); int num7 = offset; mqspi = new MQSPI(); @out = new MQSPIReserveInOut(version); @in = new MQSPIReserveIn(num5); out2 = new MQSPIReserveOut(num6); mqspi.VerbId = 6; mqspi.OutStructVersion = out2.Version; mqspi.OutStructLength = out2.Length; int translength = (((offset + mqapi.GetLength()) + mqspi.GetLength()) + @out.GetVersionLength()) + Math.Max(mqspi.OutStructLength, @in.GetVersionLength()); tsh = remoteSession.AllocateTSH(140, 0, true, translength); byte[] tshBuffer = tsh.TshBuffer; mqapi.Initialize(translength, -1); @out.Version = version; @in.Version = num5; @in.TagSize = this.tagSize; @in.TagReservation = 0x100; num7 += mqapi.WriteStruct(tshBuffer, offset); num9 = num7; num11 = num10 = num7 += mqspi.WriteStruct(tshBuffer, num7); num13 = num12 = num7 += @out.WriteStruct(tshBuffer, num7); num14 = num7 += @in.WriteStruct(tshBuffer, num7); tsh.WriteStruct(tshBuffer, 0); if (flag) { base.TrAPI(method, "__________"); base.TrAPI(method, "GetTags >>"); base.TrData(method, 0, "Hconn", BitConverter.GetBytes(remoteSession.Hconn.Value)); base.TrData(method, 0, "MQSPI", num9, num10 - num9, tshBuffer); base.TrData(method, 0, "SPI_In_Out_Structure", num11, num12 - num11, tshBuffer); base.TrData(method, 0, "SPI_Input_Structure", num13, num14 - num13, tshBuffer); base.TrAPIOutput(method, "CompCode"); base.TrAPIOutput(method, "Reason"); } tsh.TshBuffer = tshBuffer; num7 = 0; remoteSession.SendTSH(tsh); tshBuffer = null; rTSH = remoteSession.ReceiveTSH(null); byte segmentType = rTSH.SegmentType; if (segmentType == 5) { MQERD mqerd = new MQERD(); if (rTSH.Length > offset) { mqerd.ReadStruct(rTSH.TshBuffer, rTSH.Offset); } throw mqerd.ErrorException(remoteSession.ParentConnection.NegotiatedChannel.ChannelName.Trim()); } if (segmentType != 0x9c) { CommonServices.SetValidInserts(); CommonServices.ArithInsert1 = rTSH.SegmentType; CommonServices.CommentInsert1 = remoteSession.ParentConnection.NegotiatedChannel.ChannelName.Trim(); base.FFST("%Z% %W% %I% %E% %U%", "%C%", method, 1, 0x20009504, 0); throw MQERD.ErrorException(13, rTSH.SegmentType, remoteSession.ParentConnection.NegotiatedChannel.ChannelName.Trim().Trim()); } rTSH.Offset = mqapi.ReadStruct(rTSH.TshBuffer, rTSH.Offset); cc = mqapi.mqapi.CompCode; rc = mqapi.mqapi.Reason; if (cc == 2) { return(bufferArray); } rTSH.Offset = mqspi.ReadStruct(rTSH.TshBuffer, rTSH.Offset); rTSH.Offset = @out.ReadStruct(rTSH.TshBuffer, rTSH.Offset); rTSH.Offset = out2.ReadStruct(rTSH.TshBuffer, rTSH.Offset); if (rTSH != null) { remoteSession.ReleaseReceivedTSH(rTSH); } int num17 = 0; int actualReservation = out2.ActualReservation; if (actualReservation <= 0x100) { num17 = 0x100; } else { base.TrText("Unexpected tag reservation allocation: " + actualReservation + "MQRC_UNEXPECTED_ERROR"); cc = 2; rc = 0x893; base.throwNewMQException(cc, rc); } this.tagIncrementIndex = out2.TagIncrementOffset - 1; if ((this.tagIncrementIndex < 0) || (this.tagIncrementIndex >= this.tagSize)) { cc = 2; rc = 0x893; if (flag) { base.TrException(method, new Exception("Unexpected tag increment offset supplied by server: " + out2.TagIncrementOffset + "MQRC_UNEXPECTED_ERROR")); } base.throwNewMQException(cc, rc); } this.baseTag = new byte[this.tagSize]; this.baseTag = out2.BaseReservationTag; this.indexIssued = 0; this.indexIssued = this.baseTag[this.tagIncrementIndex]; if ((this.indexIssued + actualReservation) > num17) { cc = 2; rc = 0x893; base.TrException(method, new Exception("Queue manager returned counter which will wrap MQRC_UNEXPECTED_ERROR")); base.throwNewMQException(cc, rc); } Array.Copy(this.baseTag, 0, bufferArray[i], 0, this.tagSize); this.maxIndex = (this.indexIssued + actualReservation) - 1; } else { base.TrText(method, "Alloting the ID's from Reserved Pool"); this.indexIssued++; Array.Copy(this.baseTag, 0, bufferArray[i], 0, this.tagSize); bufferArray[i][this.tagIncrementIndex] = (byte)this.indexIssued; cc = 0; rc = 0; } } } finally { if (flag) { base.TrAPI(method, "__________"); base.TrAPI(method, "<< GetTags "); base.TrData(method, 0, "Hconn", BitConverter.GetBytes(remoteSession.Hconn.Value)); base.TrAPIOutput(method, "CompCode"); base.TrAPIOutput(method, "Reason"); } } return(bufferArray); }
private MQCommonServices() { lock (initialiseLock) { if (this.nativeManager == null) { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); Assembly assembly = null; for (int i = 0; i < assemblies.Length; i++) { if (assemblies[i].FullName.Contains("amqmdnet")) { assembly = assemblies[i]; break; } } if (assembly == null) { assembly = Assembly.Load("amqmdnet, PublicKeyToken=dd3cb1c9aae9ec97, Version=" + CommonServices.GetVRMF() + ", Culture=Neutral"); } nativeManagerType = assembly.GetType("IBM.WMQ.Nmqi.NativeManager"); this.nativeManager = assembly.CreateInstance("IBM.WMQ.Nmqi.NativeManager"); try { nativeManagerType.InvokeMember("InitializeNativeApis", BindingFlags.InvokeMethod, null, this.nativeManager, new object[] { "IBM.WMQ.MQCommonServices" }); } catch (Exception exception) { throw exception; } this.Initialize(); } } }
public override int GetMQCSDApplied() { return(CommonServices.GetMQCSDApplied()); }
public void Get(MQMessage message, MQGetMessageOptions gmo, int maxMsgSize) { uint method = 0x7a; this.TrEntry(method, new object[] { message, gmo, maxMsgSize }); int dataLength = 0; byte[] buffer = null; int options = -1; bool flag = true; int compCode = 0; int reason = 0; try { if (message == null) { base.throwNewMQException(2, 0x7ea); } if (gmo == null) { base.throwNewMQException(2, 0x88a); } if (maxMsgSize < 0) { base.throwNewMQException(2, 0x7d5); } options = gmo.Options; if ((gmo.Options & 0x1006) == 0) { base.TrText(method, "Setting explicit NO_SYNCPOINT"); gmo.Options |= 4; } if (base.qMgr.CommandLevel >= 700) { flag = (options & 0x1e000000) == 0; if (((options & 0x8000000) != 0) || flag) { gmo.Options &= -134217729; gmo.Options |= 0x2000000; } } if ((Transaction.Current != null) && !base.qMgr.IsXAEnabled) { base.qMgr.IsXAEnabled = true; } int characterSet = message.CharacterSet; if (!base.qMgr.IsHconnValid) { base.throwNewMQException(2, 0x7e2); } message.ClearMessage(); if (maxMsgSize == 0) { int num7 = gmo.Options; MQBase.MQMD targetMqmd = new MQBase.MQMD(); this.CopyMQMD(message.md.StructMQMD, ref targetMqmd); maxMsgSize = defaultMaxMsgSize; buffer = new byte[maxMsgSize]; gmo.Options &= -65; if ((num7 & 0x4000) == 0x4000) { MQLPIGetOpts lpiGetOpts = new MQLPIGetOpts(); lpiGetOpts.SetOptions(lpiGetOpts.GetOptions() | MQLPIGetOpts.lpiGETOPT_FULL_MESSAGE); ((NmqiSP)base.qMgr.nmqiConnector).zstMQGET(base.qMgr.hConn, base.objectHandle.HOBJ, ref message.md, ref gmo, maxMsgSize, buffer, out dataLength, lpiGetOpts, out compCode, out reason); } else { base.qMgr.nmqiConnector.MQGET(base.qMgr.hConn, base.hObj, message.md, gmo, maxMsgSize, buffer, out dataLength, out compCode, out reason); } if (0x7da == reason) { maxMsgSize = dataLength; buffer = new byte[maxMsgSize]; base.qMgr.nmqiConnector.MQGET(base.qMgr.hConn, base.hObj, message.md, gmo, maxMsgSize, buffer, out dataLength, out compCode, out reason); } while ((compCode != 0) && (0x820 == reason)) { gmo.Options = num7; MQBase.MQMD structMQMD = message.md.StructMQMD; this.CopyMQMD(targetMqmd, ref structMQMD); message.md.StructMQMD = structMQMD; maxMsgSize = dataLength; buffer = new byte[maxMsgSize]; gmo.Options &= -65; base.qMgr.nmqiConnector.MQGET(base.qMgr.hConn, base.hObj, message.md, gmo, maxMsgSize, buffer, out dataLength, out compCode, out reason); } if ((0x848 == reason) || (0x88e == reason)) { string objectId = "Server Binding convert message"; byte[] outString = null; int outLength = 0; uint bytesConverted = 0; if (CommonServices.ConvertString(objectId, message.md.StructMQMD.CodedCharacterSetId, characterSet, buffer, dataLength, out outString, ref outLength, 0, out bytesConverted) == 0) { buffer = outString; maxMsgSize = outLength; dataLength = outLength; compCode = 0; reason = 0; } } } else { buffer = new byte[maxMsgSize]; base.qMgr.nmqiConnector.MQGET(base.qMgr.hConn, base.hObj, message.md, gmo, maxMsgSize, buffer, out dataLength, out compCode, out reason); } byte[] b = buffer; if (compCode == 0) { bool flag2 = false; if (base.qMgr.CommandLevel >= 700) { if (flag) { if (this.propControl != 3) { flag2 = true; } } else if ((options & 0x8000000) != 0) { flag2 = true; } if (flag2 && (dataLength > 0x24)) { b = this.PerformMsgProcessingAfterGet(ref message, buffer, (dataLength > buffer.Length) ? buffer.Length : dataLength); dataLength = b.Length; } } } message.totalMessageLength = dataLength; if (dataLength > 0) { message.Write(b, 0, (dataLength < maxMsgSize) ? dataLength : maxMsgSize); message.Seek(0); } if (compCode != 0) { base.qMgr.CheckHConnHealth(reason); base.throwNewMQException(compCode, reason); } } catch (MQException exception) { compCode = exception.CompCode; reason = exception.Reason; throw exception; } catch (Exception exception2) { base.TrException(method, exception2); compCode = 2; reason = 0x893; throw exception2; } finally { base.unsafe_compCode = compCode; base.unsafe_reason = reason; gmo.Options = options; base.TrExit(method); } }
internal static void SetProductId(string connectionTypeName) { StringBuilder builder = new StringBuilder(); string str2 = connectionTypeName; if (str2 == null) { return; } if (!(str2 == "CLIENT") && !(str2 == "XACLIENT")) { if (!(str2 == "MANAGEDCLIENT")) { return; } } else { builder.Append("MQNU"); goto Label_0054; } builder.Append("MQNM"); Label_0054: try { int mQVersion = MQVersion; int mQRelease = MQRelease; int num3 = 0; int num4 = 0; string[] strArray = CommonServices.GetVRMF().Split(new char[] { '.' }); if (strArray.Length >= 3) { num3 = int.Parse(strArray[2]); if (strArray.Length >= 4) { string s = strArray[3]; if (strArray.Length > 4) { s = s + strArray[4]; } num4 = int.Parse(s); } } if (mQVersion <= 9) { builder.Append(0); builder.Append(mQVersion); } else { builder.Append(mQVersion); } if (mQRelease <= 9) { builder.Append(0); builder.Append(mQRelease); } else { builder.Append(mQRelease); } if (num3 <= 9) { builder.Append(0); builder.Append(num3); } else { builder.Append(num3); } if (num4 <= 9) { builder.Append(0); builder.Append(num4); } else { builder.Append(num4); } } catch (Exception) { } productIdentifier = builder.ToString().PadRight(12, '0'); }
internal override int Send(byte[] bytes, int offset, int length, int segmentType, int tshType) { uint method = 0x2cc; bool flag = CommonServices.TraceEnabled(); if (flag) { this.TrEntry(method, new object[] { bytes, offset, length }); } int num2 = 0; int num3 = 0; int num4 = 0; try { if (this.socket == null) { throw new MQManagedClientException("Socket null", 2, 0x893); } if (flag) { base.TrText("----------------"); base.TrCommsData(method, 2, "Send Buffer", offset, length, bytes); base.TrText(method, " Data Length --> " + length); } num3 = offset; goto Label_021B; Label_0095: while (!this.socket.Poll(0x186a0, SelectMode.SelectWrite)) { } try { num2 = 0; base.TrText(method, "Send >>"); num2 = this.network.Write(bytes, num3, length); if (flag) { base.TrText(method, "Send returned " + num2); } if (num2 <= 0) { return(num4); } length -= num2; num3 += num2; } catch (SocketException exception) { base.TrException(method, exception, 1); if (exception.ErrorCode == 0x274a) { NmqiException ex = new NmqiException(base.env, -1, new string[] { exception.Message, exception.StackTrace, exception.SocketErrorCode.ToString() }, 2, 0x7d9, exception); base.TrException(method, ex); throw ex; } if (exception.ErrorCode != 0x2733) { base.TrText(method, "e.ErrorCode = " + exception.ErrorCode); NmqiException exception3 = new NmqiException(base.env, -1, new string[] { exception.Message, exception.StackTrace, exception.SocketErrorCode.ToString() }, 2, 0x7d9, exception); base.TrException(method, exception3); throw exception3; } base.TrException(method, exception); base.TrText(method, "Exception Received - Not bubling the exception as this is found to be common when socket is quite busy with loads of sends"); goto Label_0095; } finally { base.TrText(method, "Send << - n = " + num2); } Label_021B: if (length > 0) { goto Label_0095; } return(1); } catch (SocketException exception4) { base.TrException(method, exception4, 2); CommonServices.SetValidInserts(); CommonServices.ArithInsert1 = (uint)exception4.ErrorCode; CommonServices.ArithInsert2 = (uint)exception4.ErrorCode; CommonServices.CommentInsert1 = this.conname; CommonServices.CommentInsert2 = "TCP/IP"; CommonServices.CommentInsert3 = " (socket.Send)"; base.DisplayMessage(0x20009206, 0xf0000010); NmqiException exception5 = new NmqiException(base.env, -1, null, 2, 0x7d9, exception4); throw exception5; } catch (MQException exception6) { base.TrException(method, exception6); throw exception6; } catch (Exception exception7) { base.TrException(method, exception7); NmqiException exception8 = new NmqiException(base.env, -1, null, 2, 0x893, exception7); throw exception8; } finally { base.TrExit(method); } return(num4); }
internal override int Receive(byte[] cBuffer, int offset, int length, SocketFlags flags) { uint method = 0x2cd; this.TrEntry(method, new object[] { cBuffer, offset, length }); bool flag = false; int num2 = offset; int num3 = length; int num4 = 0; try { if (this.socket == null) { return(-1); } if ((this.socket == null) || !this.connected) { return(-1); } if (this.timeoutChanged && this.connected) { this.socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveTimeout, (int)(this.timeout + 0x3e8)); base.TrText(method, "ReceiveTimeout set to " + this.timeout); this.timeoutChanged = false; } if (this.socket.Blocking) { try { num4 = this.network.Read(cBuffer, num2, num3); goto Label_030E; } catch (SocketException exception) { throw exception; } } Label_00DC: if ((this.socket == null) || !this.connected) { return(num4); } try { num4 = this.network.Read(cBuffer, num2, num3); } catch (NmqiException exception2) { base.TrException(method, exception2); throw exception2; } catch (SocketException exception3) { base.TrException(method, exception3, 1); if (exception3.ErrorCode == 0x2733) { base.TrException(method, exception3); base.TrText(method, "Exception Received - Not bubling the exception as this is found to be common when socket is quite busy with loads of sends"); goto Label_00DC; } if (exception3.ErrorCode == 0x274a) { return(-1); } if (exception3.ErrorCode != 0x2745) { throw exception3; } if ((flag && (num4 <= 0)) || !this.multiplexingEnabled) { num4 = -1; } else { if (DateTime.Compare(DateTime.UtcNow, this.nextHeartBeatSendTime) > 0) { if ((this.socket == null) || !this.connected) { goto Label_0238; } try { base.SendHeartbeat(1); } catch (NmqiException exception4) { base.TrException(method, exception4); num4 = -1; goto Label_030E; } catch (SocketException exception5) { base.TrException(method, exception5); num4 = -1; goto Label_030E; } flag = true; this.timeout = Math.Min(0xea60, this.timeout); this.timeoutChanged = true; this.nextHeartBeatSendTime = DateTime.UtcNow; this.nextHeartBeatSendTime = this.nextHeartBeatSendTime.AddSeconds((double)this.heartbeatInterval); goto Label_00DC; } num4 = -1; } goto Label_030E; } Label_0238: if (num4 > 0) { if (flag) { flag = false; this.timeout = this.heartbeatInterval; this.timeoutChanged = true; } } else if ((flag && (num4 <= 0)) || !this.multiplexingEnabled) { num4 = -1; } else { if ((num4 > 0) || !this.connected) { goto Label_00DC; } if (DateTime.Compare(DateTime.UtcNow, this.nextHeartBeatSendTime) > 0) { try { base.SendHeartbeat(1); } catch (NmqiException exception6) { base.TrException(method, exception6); num4 = -1; goto Label_030E; } catch (SocketException exception7) { base.TrException(method, exception7); num4 = -1; goto Label_030E; } flag = true; this.timeout = Math.Min(0xea60, this.timeout); this.timeoutChanged = true; this.nextHeartBeatSendTime = DateTime.UtcNow; this.nextHeartBeatSendTime = this.nextHeartBeatSendTime.AddSeconds((double)this.heartbeatInterval); goto Label_00DC; } num4 = -1; } Label_030E: length = num3; offset = num2; return(num4); } catch (SocketException exception8) { base.TrException(method, exception8, 2); CommonServices.SetValidInserts(); CommonServices.ArithInsert1 = (uint)exception8.ErrorCode; CommonServices.ArithInsert2 = (uint)exception8.ErrorCode; CommonServices.CommentInsert2 = "TCP/IP"; CommonServices.CommentInsert3 = " (socket.Receive)"; base.DisplayMessage(0x20009208, 0xf0000010); NmqiException exception9 = new NmqiException(base.env, -1, null, 2, 0x7d9, exception8); throw exception9; } catch (ObjectDisposedException exception10) { base.TrException(method, exception10, 3); } catch (NmqiException exception11) { base.TrException(method, exception11); throw exception11; } catch (Exception exception12) { base.TrException(method, exception12, 5); NmqiException exception13 = new NmqiException(base.env, -1, null, 2, 0x7d9, exception12); throw exception13; } finally { base.TrExit(method); } return(num4); }
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); }