Esempio n. 1
0
 public MQSPIGetInOut(int version)
 {
     base.TrConstructor("%Z% %W%  %I% %E% %U%", new object[] { version });
     this.spiGetInOutHdr    = new SPIGETNOUTHDR();
     this.spiGetInOutHdr.ID = rfpVB_ID_GET_INOUT;
     this.Version           = version;
     this.md  = null;
     this.gmo = null;
 }
Esempio n. 2
0
        public void Get(MQMessage message, MQGetMessageOptions gmo)
        {
            uint method = 0x79;

            this.TrEntry(method, new object[] { message, gmo });
            try
            {
                this.Get(message, gmo, 0);
            }
            finally
            {
                base.TrExit(method);
            }
        }
 public MQGetMessageOptions(MQGetMessageOptions mqgmo)
 {
     this.mqGMO = new MQBase.MQGMO();
     base.TrConstructor("%Z% %W%  %I% %E% %U%", new object[] { mqgmo });
     this.mqGMO.StrucId       = (byte[])mqgmo.mqGMO.StrucId.Clone();
     this.mqGMO.Version       = mqgmo.mqGMO.Version;
     this.mqGMO.Options       = mqgmo.mqGMO.Options;
     this.mqGMO.WaitInterval  = mqgmo.mqGMO.WaitInterval;
     this.mqGMO.Signal1       = mqgmo.mqGMO.Signal1;
     this.mqGMO.Signal2       = mqgmo.mqGMO.Signal2;
     this.mqGMO.ResolvedQName = new byte[0x30];
     Buffer.BlockCopy(mqgmo.mqGMO.ResolvedQName, 0, this.mqGMO.ResolvedQName, 0, mqgmo.mqGMO.ResolvedQName.Length);
     this.mqGMO.MatchOptions  = mqgmo.mqGMO.MatchOptions;
     this.mqGMO.GroupStatus   = mqgmo.mqGMO.GroupStatus;
     this.mqGMO.SegmentStatus = mqgmo.mqGMO.SegmentStatus;
     this.mqGMO.Segmentation  = mqgmo.mqGMO.Segmentation;
     this.mqGMO.Reserved1     = mqgmo.mqGMO.Reserved1;
     this.mqGMO.MsgToken      = new byte[0x10];
     Buffer.BlockCopy(mqgmo.mqGMO.MsgToken, 0, this.mqGMO.MsgToken, 0, mqgmo.mqGMO.MsgToken.Length);
     this.mqGMO.ReturnedLength = mqgmo.mqGMO.ReturnedLength;
 }
Esempio n. 4
0
        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);
            }
        }
Esempio n. 5
0
        public void Get(MQMessage message, MQGetMessageOptions gmo, int maxMsgSize, int spigmo)
        {
            uint method = 550;

            this.TrEntry(method, new object[] { message, gmo, maxMsgSize, spigmo });
            int  num2       = 0;
            bool flag       = false;
            int  dataLength = 0;

            byte[] buffer   = null;
            int    compCode = 0;
            int    reason   = 0;

            try
            {
                NmqiSP nmqiConnector = (NmqiSP)base.qMgr.nmqiConnector;
                if (message == null)
                {
                    base.throwNewMQException(2, 0x7ea);
                }
                if (gmo == null)
                {
                    base.throwNewMQException(2, 0x88a);
                }
                if (maxMsgSize < 0)
                {
                    base.throwNewMQException(2, 0x7d5);
                }
                MQSPIGetOpts spigo        = new MQSPIGetOpts(spigmo);
                int          options      = gmo.Options;
                int          characterSet = message.CharacterSet;
                int          num7         = gmo.Options;
                if ((num7 & 0x8000000) != 0)
                {
                    gmo.Options &= -134217729;
                    gmo.Options |= 0x2000000;
                }
                else if ((((num7 & 0x10000000) == 0) && ((num7 & 0x2000000) == 0)) && ((num7 & 0x4000000) == 0))
                {
                    gmo.Options |= 0x2000000;
                }
                message.ClearMessage();
                num2 = gmo.Options;
                flag = true;
                if ((gmo.Options & 0x1006) == 0)
                {
                    gmo.Options |= 4;
                }
                if (maxMsgSize == 0)
                {
                    int         num8       = gmo.Options;
                    MQBase.MQMD targetMqmd = new MQBase.MQMD();
                    base.CopyMQMD(message.md.StructMQMD, ref targetMqmd);
                    maxMsgSize   = MQDestination.defaultMaxMsgSize;
                    buffer       = new byte[maxMsgSize];
                    gmo.Options &= -65;
                    nmqiConnector.SPIGet(base.qMgr.hConn, base.objectHandle.HOBJ, ref message.md, ref gmo, ref spigo, maxMsgSize, buffer, out dataLength, out compCode, out reason);
                    while ((1 == compCode) && (0x820 == reason))
                    {
                        gmo.Options = num8;
                        MQBase.MQMD structMQMD = message.md.StructMQMD;
                        base.CopyMQMD(targetMqmd, ref structMQMD);
                        message.md.StructMQMD = structMQMD;
                        maxMsgSize            = dataLength;
                        buffer       = new byte[maxMsgSize];
                        gmo.Options &= -65;
                        nmqiConnector.SPIGet(base.qMgr.hConn, base.objectHandle.HOBJ, ref message.md, ref gmo, ref spigo, maxMsgSize, buffer, out dataLength, out compCode, out reason);
                    }
                    gmo.Options = num8;
                }
                else
                {
                    buffer = new byte[maxMsgSize];
                    nmqiConnector.SPIGet(base.qMgr.hConn, base.objectHandle.HOBJ, ref message.md, ref gmo, ref spigo, maxMsgSize, buffer, out dataLength, out compCode, out reason);
                }
                if (compCode != 2)
                {
                    this.spiQueueEmpty   = spigo.QueueEmpty != 0;
                    message.spiInherited = spigo.Inherited != 0;
                    message.spiQTime     = spigo.QTime;
                }
                else
                {
                    this.spiQueueEmpty   = false;
                    message.spiInherited = false;
                    message.spiQTime     = 0L;
                }
                byte[] b = null;
                if (compCode != 2)
                {
                    if ((options & 0x2000000) == 0)
                    {
                        b = base.PerformMsgProcessingAfterGet(ref message, buffer, (dataLength > buffer.Length) ? buffer.Length : dataLength);
                    }
                    else
                    {
                        b = buffer;
                    }
                    dataLength = b.Length;
                }
                gmo.Options = options;
                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;
            }
            finally
            {
                if (flag)
                {
                    gmo.Options = num2;
                }
                base.unsafe_compCode = compCode;
                base.unsafe_reason   = reason;
                base.TrExit(method);
            }
        }