ndr_marshal.c revision 2
2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License (the "License"). 2N/A * You may not use this file except in compliance with the License. 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved. 2N/A * Perform the (un)marshalling 2N/A * Decode an NDR encoded buffer. The buffer is expected to contain 2N/A * a single fragment packet with a valid PDU header followed by NDR 2N/A * encoded data. The structure to which result points should be 2N/A * of the appropriate type to hold the decoded output. For example: 2N/A * if ((nbuf = ndr_buf_init(&TYPEINFO(ndr_pac)) != NULL) { 2N/A * rc = ndr_decode_buf(nbuf, opnum, data, datalen, &info); 2N/A * ndr_buf_fini(nbuf); 2N/A * Use the receive stream to unmarshall data (NDR_MODE_CALL_RECV). 2N/A * Use the send stream to marshall data (NDR_MODE_RETURN_SEND). 2N/A * Use the send stream to marshall data (NDR_MODE_CALL_SEND). 2N/A * Use the receive stream to unmarshall data (NDR_MODE_RETURN_RECV). 2N/A * Verify the protocol version. 2N/A * All PDU headers are at least this big 2N/A * Peek at the first eight bytes to figure out what we're doing. 2N/A * Check for ASCII as the character set. This is an ASCII 2N/A * versus EBCDIC option and has nothing to do with Unicode. 2N/A * Set the byte swap flag if the PDU byte-order 2N/A * is different from the local byte-order. 2N/A * All PDU headers are at least this big 2N/A * Peek at the first eight bytes to figure out what we're doing. 2N/A /* Must be set to 1 to indicate type serialization version 1. */ 2N/A * Set the byte swap flag if the PDU byte-order 2N/A * is different from the local byte-order. 2N/A * Decode an RPC fragment header. Use ndr_decode_pdu_hdr() to process 2N/A * the first fragment header then this function to process additional 2N/A * Swap non-byte fields if the PDU byte-order 2N/A * is different from the local byte-order. 2N/A /*LINTED E_BAD_PTR_CAST_ALIGN*/ 2N/A * Remove an RPC fragment header from the received data stream. 2N/A * NDR stream on entry: 2N/A * +-----+--------+-----+--------+-----+---------+-----+ 2N/A * | hdr | data | hdr | data | hdr | data | ... | 2N/A * +-----+--------+-----+--------+-----+---------+-----+ 2N/A * NDR stream on return: 2N/A * +-----+----------------+-----+---------+-----+ 2N/A * | hdr | data | hdr | data | ... | 2N/A * +-----+----------------+-----+---------+-----+ 2N/A "ndr hdr: %d.%d ptype=%d, %s frag (flags=0x%08x) len=%d",
2N/A * This is a hand-coded derivative of the automatically generated 2N/A * (un)marshalling routine for bind_ack headers. bind_ack headers 2N/A * have an interior conformant array, which is inconsistent with 2N/A 1,
/* NDR version */ 2N/A 68,
/* pdu_size_fixed_part */ 2N/A 0,
/* pdu_size_variable_part */ 2N/A 68,
/* c_size_fixed_part */ 2N/A 0,
/* c_size_variable_part */ 2N/A /* do all members in order */ 2N/A /* port any is the conformant culprit */ 2N/A * Assume a single presentation context element in the result list. 2N/A /* port any is the conformant culprit */ 2N/A * This is a hand-coded derivative of the automatically generated 2N/A * (un)marshalling routine for alter_context_rsp headers. 2N/A * Alter context response headers have an interior conformant array, 2N/A 1,
/* NDR version */ 2N/A 56,
/* pdu_size_fixed_part */ 2N/A 0,
/* pdu_size_variable_part */ 2N/A 56,
/* c_size_fixed_part */ 2N/A 0,
/* c_size_variable_part */ 2N/A /* do all members in order */ 2N/A * Assume a single presentation context element in the result list.