コード例 #1
0
        public WriteStructuredFieldCommand(InputByteArray InputArray)
            : base(InputArray, WorkstationCode.WriteStructuredField)
        {
            byte[] buf = null;

            // advance past the 0x04 and  0xf3.
            InputArray.AdvanceIndex(2);

            // first 2 bytes are the LL length bytes.
            this.llLength = InputArray.PeekBigEndianShort(0);

            // make sure enough length remaining in the input array
            if (this.llLength > InputArray.RemainingLength)
            {
                this.Errmsg = "LL length " + this.llLength.ToString()
                              + " exceeds remaining length of input array.";
            }

            // setup c field and t field
            if (this.Errmsg == null)
            {
                buf         = InputArray.GetBytes(this.llLength);
                this.cField = buf[2];
                this.tField = buf[3];

                this.RequestCode = this.tField.ToRequestCode();
            }

            if (this.Errmsg == null)
            {
                this.BytesLength += this.llLength;
                this.FormatFlags  = null;
                this.FormatFlags  = buf.SubArray(4, 1);
            }
        }
コード例 #2
0
        public Query5250Response(InputByteArray InputArray)
        {
            InputByteArray buf = null;

            if (InputArray.RemainingLength < 58)
            {
                this.Errmsg = "Insufficient bytes in byte stream for 5250 query response.";
            }

            if (this.Errmsg == null)
            {
                this.Length = InputArray.PeekBigEndianShort(0);
                if (InputArray.RemainingLength < this.Length)
                {
                    this.Errmsg = "response length exceeds byte stream.";
                }
            }

            if (this.Errmsg == null)
            {
                this.RawBytes = InputArray.PeekBytes(this.Length);
                buf           = new InputByteArray(this.RawBytes);
                buf.AdvanceIndex(2); // the length
                this.cField = buf.GetByte();
                var tField = buf.GetByte();
                this.RequestCode  = tField.ToRequestCode();
                this.ResponseByte = buf.GetByte(); // 0x80 fixed code

                if ((cField != 0xd9) || (this.RequestCode == null) ||
                    (this.ResponseByte != 0x80))
                {
                    this.Errmsg = "invalid c Field, t Field or response byte in 5250 "
                                  + "query response.";
                }
            }

            // isolate other 5250 query response fields.
            if (this.Errmsg == null)
            {
                this.ControlUnitCode = buf.GetBytes(2);
                this.CodeLevel       = buf.GetBytes(3);
                this.Reserve1        = buf.GetBytes(16);

                this.WorkstationByte = buf.GetByte();
                this.MachineType     = buf.GetEbcdicBytes(7);
                this.KeyboardId      = buf.GetByte();
                buf.AdvanceIndex(2);
                this.SerialNumber   = buf.GetBytes(4);
                this.MaxInputFields = buf.GetBigEndianShort();
                this.Reserve2       = buf.GetBytes(3);
                this.Capabilities   = buf.GetBytes(5);
            }

            // is a valid query 5250 response byte stream. Advance index of input bytes.
            if (this.Errmsg == null)
            {
                InputArray.AdvanceIndex(this.Length);
            }
        }
コード例 #3
0
        public Query5250Response(InputByteArray InputArray)
        {
            InputByteArray buf = null;

            if (InputArray.RemainingLength < 58)
            {
                this.Errmsg = "insufficient remaining length.";
            }

            // isolate length and raw bytes.
            if (this.Errmsg == null)
            {
                this.Length = InputArray.PeekBigEndianShort(0);
                if (this.Length > InputArray.RemainingLength)
                {
                    this.Errmsg = "query 5250 response length exceeds byte stream length";
                }
                else
                {
                    this.RawBytes = InputArray.PeekBytes(this.Length);
                    buf           = new InputByteArray(this.RawBytes);
                }
            }

            // isolate components of the response stream.
            if (this.Errmsg == null)
            {
                buf.GetBigEndianShort();
                this.ResponseCode = buf.SubArray(2, 3);
            }

            // isolate components of the response stream.
            if (this.Errmsg == null)
            {
                this.ResponseCode = buf.SubArray(2, 3);
            }

            ra.Append(new byte[] { 0xd9, 0x70, 0x80 });             // 5250 query response
            ra.Append(new byte[] { 0x06, 0x00 });                   // control unit code.
            ra.Append(new byte[] { 0x01, 0x03, 0x00 });             // code release level.
            ra.Append(byteZero.Repeat(16));                         // 16 bytes of null
            ra.Append(0x01);                                        // 01 - display station
            ra.Append("3180002".ToEbcdicBytes());                   // machine type and model.
            ra.Append(0x02);                                        // keyboard id
            ra.Append(0x00);                                        // extended keyboard id
            ra.Append(0x00);                                        // reserve
            ra.Append(new byte[] { 0x00, 0x61, 0x50, 0x00 });       // device serial number.
            ra.AppendBigEndianShort(256);                           // max number input fields.
            ra.Append(0x00);                                        // control unit customization
            ra.Append(new byte[] { 0x00, 0x00 });                   // reserved
            ra.Append(new byte[] { 0x18, 0x11, 0x00, 0x00, 0x00 }); //
            ra.Append(byteZero.Repeat(7));                          // 7 bytes of null.
        }
コード例 #4
0
        public WriteStructuredFieldCommand(InputByteArray InputArray)
            : base(InputArray, WorkstationCode.WriteStructuredField)
        {
            // advance past the 0x04 and  0xf3.
            InputArray.AdvanceIndex(2);

            // first 2 bytes are the LL length bytes.
            this.llLength = InputArray.PeekBigEndianShort(0);

            // make sure enough length remaining in the input array
            if (this.llLength > InputArray.RemainingLength)
            {
                this.Errmsg = "LL length " + this.llLength.ToString( )
                              + " exceeds remaining length of input array.";
            }

            if (this.Errmsg == null)
            {
                this.BytesLength += this.llLength;

                var buf = InputArray.GetBytes(this.llLength);
                this.FormatFlags = null;

                // isolate cField and tField
                this.cField = buf[2];
                this.tField = buf[3];

                // 5250 query. format flags are 1 byte.
                if (this.cField == 0xd9)
                {
                    if (this.tField == 0x30)
                    {
                        this.RequestCode = WSF_RequestCode.DefineAuditWindow;
                    }
                    else if (this.tField == 0x31)
                    {
                        this.RequestCode = WSF_RequestCode.DefineCmdKeyFunc;
                    }
                    else if (this.tField == 0x70)
                    {
                        this.FormatFlags = buf.SubArray(4, 1);
                        this.RequestCode = WSF_RequestCode.Query5250;
                    }
                }
            }
        }
コード例 #5
0
        public WriteSingleStructuredFieldCommand(InputByteArray InputArray)
            : base(InputArray, WorkstationCode.WriteSingleStructuredField)
        {
            byte[] buf = null;

            // advance past the 0x04 and  0xf4.
            InputArray.AdvanceIndex(2);

            // first 2 bytes are the LL length bytes.
            this.llLength = InputArray.PeekBigEndianShort(0);

            // make sure enough length remaining in the input array
            if (this.llLength > InputArray.RemainingLength)
            {
                this.Errmsg = "LL length " + this.llLength.ToString()
                              + " exceeds remaining length of input array.";
            }

            // setup c field and t field
            if (this.Errmsg == null)
            {
                buf          = InputArray.GetBytes(this.llLength);
                this.cField  = buf[2];
                this.tField  = buf[3];
                this.f1Field = buf[4];
                this.f2Field = buf[5];

                // command contains minor structure.
                if (this.llLength > 8)
                {
                    this.minor_ll = buf[6];
                    this.minor_t  = buf[7];
                    this.minor_f  = buf[8];
                }
            }

            if (this.Errmsg == null)
            {
                this.BytesLength += this.llLength;
            }
        }