Esempio n. 1
0
        public BindAckPDU(byte[] buffer, int offset) : base(buffer, offset)
        {
            int startOffset = offset;

            offset += CommonFieldsLength;
            MaxTransmitFragmentSize = LittleEndianReader.ReadUInt16(buffer, ref offset);
            MaxReceiveFragmentSize  = LittleEndianReader.ReadUInt16(buffer, ref offset);
            AssociationGroupID      = LittleEndianReader.ReadUInt32(buffer, ref offset);
            SecondaryAddress        = RPCHelper.ReadPortAddress(buffer, ref offset);
            int padding = (4 - ((offset - startOffset) % 4)) % 4;

            offset      += padding;
            ResultList   = new ResultList(buffer, offset);
            offset      += ResultList.Length;
            AuthVerifier = ByteReader.ReadBytes(buffer, offset, AuthLength);
        }
Esempio n. 2
0
        public override byte[] GetBytes()
        {
            AuthLength = (ushort)AuthVerifier.Length;
            int padding = (4 - ((SecondaryAddress.Length + 3) % 4)) % 4;

            byte[] buffer = new byte[Length];
            WriteCommonFieldsBytes(buffer);
            int offset = CommonFieldsLength;

            LittleEndianWriter.WriteUInt16(buffer, ref offset, MaxTransmitFragmentSize);
            LittleEndianWriter.WriteUInt16(buffer, ref offset, MaxReceiveFragmentSize);
            LittleEndianWriter.WriteUInt32(buffer, ref offset, AssociationGroupID);
            RPCHelper.WritePortAddress(buffer, ref offset, SecondaryAddress);
            offset += padding;
            ResultList.WriteBytes(buffer, ref offset);
            ByteWriter.WriteBytes(buffer, offset, AuthVerifier);

            return(buffer);
        }