コード例 #1
0
 /// <summary>
 /// Un-marshal a byte array to PDU struct.
 /// </summary>
 /// <param name="binaryReader">BinaryReader</param>
 internal override void FromBytes(BinaryReader binaryReader)
 {
     base.FromBytes(binaryReader);
     auth_verifier = RpceUtility.AuthVerifierFromBytes(
         binaryReader,
         auth_length);
 }
コード例 #2
0
        /// <summary>
        /// Append verification_trailer to stub.
        /// </summary>
        /// <param name="verificationTrailer">verification_trailer</param>
        /// <exception cref="ArgumentNullException">Thrown when verificationTrailer is null.</exception>
        public void AppendVerificationTrailerToStub(verification_trailer_t verificationTrailer)
        {
            if (verificationTrailer == null)
            {
                throw new ArgumentNullException("verificationTrailer");
            }

            if (stub == null)
            {
                stub = new byte[0];
            }

            stub = RpceUtility.AppendVerificationTrailerToStub(stub, verificationTrailer);

            if (auth_verifier != null)
            {
                auth_verifier_co_t authVerifier = auth_verifier.Value;
                authVerifier.auth_pad_length = (byte)(
                    RpceUtility.Align(stub.Length, RpceUtility.STUB_PAD_LENGTH) - stub.Length);
                authVerifier.auth_pad = new byte[authVerifier.auth_pad_length];
                auth_verifier = authVerifier;
            }

            SetLength();
        }
コード例 #3
0
        /// <summary>
        /// Un-marshal a byte array to PDU struct.
        /// </summary>
        /// <param name="binaryReader">BinaryReader</param>
        internal override void FromBytes(BinaryReader binaryReader)
        {
            base.FromBytes(binaryReader);

            auth_verifier = RpceUtility.AuthVerifierFromBytes(
              binaryReader,
              auth_length);

            alloc_hint = binaryReader.ReadUInt32();
            p_cont_id = binaryReader.ReadUInt16();
            opnum = binaryReader.ReadUInt16();

            if ((pfc_flags & RpceCoPfcFlags.PFC_OBJECT_UUID) != 0)
            {
                @object = new Guid(binaryReader.ReadBytes(RpceUtility.GUID_SIZE));
            }

            int stubLength = frag_length;
            stubLength -= GetSize();
            if (auth_verifier != null)
            {
                stubLength -= auth_verifier.Value.auth_pad_length;
                stubLength -= RpceUtility.AUTH_VERIFIER_SIZE;
                stubLength -= auth_length;
            }
            stub = binaryReader.ReadBytes(stubLength);
        }
コード例 #4
0
        /// <summary>
        /// Un-marshal a byte array to PDU struct.
        /// </summary>
        /// <param name="binaryReader">BinaryReader</param>
        internal override void FromBytes(BinaryReader binaryReader)
        {
            base.FromBytes(binaryReader);

            auth_verifier = RpceUtility.AuthVerifierFromBytes(
                binaryReader,
                auth_length);

            max_xmit_frag = binaryReader.ReadUInt16();
            max_recv_frag = binaryReader.ReadUInt16();
            assoc_group_id = binaryReader.ReadUInt32();

            p_context_elem = new p_cont_list_t();

            p_context_elem.n_context_elem = binaryReader.ReadByte();
            p_context_elem.reserved = binaryReader.ReadByte();
            p_context_elem.reserved2 = binaryReader.ReadUInt16();

            p_context_elem.p_cont_elem = new p_cont_elem_t[p_context_elem.n_context_elem];
            for (int i = 0; i < p_context_elem.n_context_elem; i++)
            {
                p_context_elem.p_cont_elem[i].p_cont_id = binaryReader.ReadUInt16();
                p_context_elem.p_cont_elem[i].n_transfer_syn = binaryReader.ReadByte();
                p_context_elem.p_cont_elem[i].reserved = binaryReader.ReadByte();

                p_context_elem.p_cont_elem[i].abstract_syntax = new p_syntax_id_t();
                p_context_elem.p_cont_elem[i].abstract_syntax.if_uuid
                    = new Guid(binaryReader.ReadBytes(RpceUtility.GUID_SIZE));
                p_context_elem.p_cont_elem[i].abstract_syntax.if_vers_major
                    = binaryReader.ReadUInt16();
                p_context_elem.p_cont_elem[i].abstract_syntax.if_vers_minor
                    = binaryReader.ReadUInt16();

                p_context_elem.p_cont_elem[i].transfer_syntaxes
                    = new p_syntax_id_t[p_context_elem.p_cont_elem[i].n_transfer_syn];
                for (int j = 0; j < p_context_elem.p_cont_elem[i].transfer_syntaxes.Length; j++)
                {
                    p_context_elem.p_cont_elem[i].transfer_syntaxes[j].if_uuid
                        = new Guid(binaryReader.ReadBytes(RpceUtility.GUID_SIZE));
                    p_context_elem.p_cont_elem[i].transfer_syntaxes[j].if_vers_major
                        = binaryReader.ReadUInt16();
                    p_context_elem.p_cont_elem[i].transfer_syntaxes[j].if_vers_minor
                        = binaryReader.ReadUInt16();
                }
            }
        }
コード例 #5
0
        /// <summary>
        /// Un-marshal a byte array to PDU struct.
        /// </summary>
        /// <param name="binaryReader">BinaryReader</param>
        internal override void FromBytes(BinaryReader binaryReader)
        {
            base.FromBytes(binaryReader);

            auth_verifier = RpceUtility.AuthVerifierFromBytes(
                binaryReader,
                auth_length);

            alloc_hint = binaryReader.ReadUInt32();
            p_cont_id = binaryReader.ReadUInt16();
            cancel_count = binaryReader.ReadByte();
            reserved = binaryReader.ReadByte();

            // read stub.
            int stubLength = frag_length;
            stubLength -= GetSize();
            if (auth_verifier != null)
            {
                stubLength -= auth_verifier.Value.auth_pad_length;
                stubLength -= RpceUtility.AUTH_VERIFIER_SIZE;
                stubLength -= auth_length;
            }
            stub = binaryReader.ReadBytes(stubLength);
        }
        /// <summary>
        /// Un-marshal a byte array to PDU struct.
        /// </summary>
        /// <param name="binaryReader">BinaryReader</param>
        internal override void FromBytes(BinaryReader binaryReader)
        {
            base.FromBytes(binaryReader);

            auth_verifier = RpceUtility.AuthVerifierFromBytes(
                binaryReader,
                auth_length);

            max_xmit_frag = binaryReader.ReadUInt16();
            max_recv_frag = binaryReader.ReadUInt16();
            assoc_group_id = binaryReader.ReadUInt32();

            sec_addr = new port_any_t();
            sec_addr.length = binaryReader.ReadUInt16();
            sec_addr.port_spec = binaryReader.ReadBytes(sec_addr.length);

            // restore 4-octet alignment
            int pad2length = RpceUtility.Align((int)binaryReader.BaseStream.Position, 4)
                                - (int)binaryReader.BaseStream.Position;
            pad2 = binaryReader.ReadBytes(pad2length);

            p_result_list = new p_result_list_t();
            p_result_list.n_results = binaryReader.ReadByte();
            p_result_list.reserved = binaryReader.ReadByte();
            p_result_list.reserved2 = binaryReader.ReadUInt16();

            p_result_list.p_results = new p_result_t[p_result_list.n_results];
            for (int i = 0; i < p_result_list.n_results; i++)
            {
                p_result_list.p_results[i].result = (p_cont_def_result_t)binaryReader.ReadUInt16();
                p_result_list.p_results[i].reason = (p_provider_reason_t)binaryReader.ReadUInt16();
                p_result_list.p_results[i].transfer_syntax = new p_syntax_id_t();
                p_result_list.p_results[i].transfer_syntax.if_uuid
                    = new Guid(binaryReader.ReadBytes(RpceUtility.GUID_SIZE));
                p_result_list.p_results[i].transfer_syntax.if_vers_major
                    = binaryReader.ReadUInt16();
                p_result_list.p_results[i].transfer_syntax.if_vers_minor
                    = binaryReader.ReadUInt16();
            }
        }