Line data Source code
1 : /* 2 : Unix SMB/CIFS implementation. 3 : 4 : helper routines for FRSRPC marshalling 5 : 6 : Copyright (C) Stefan (metze) Metzmacher 2009 7 : 8 : This program is free software; you can redistribute it and/or modify 9 : it under the terms of the GNU General Public License as published by 10 : the Free Software Foundation; either version 3 of the License, or 11 : (at your option) any later version. 12 : 13 : This program is distributed in the hope that it will be useful, 14 : but WITHOUT ANY WARRANTY; without even the implied warranty of 15 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 : GNU General Public License for more details. 17 : 18 : You should have received a copy of the GNU General Public License 19 : along with this program. If not, see <http://www.gnu.org/licenses/>. 20 : */ 21 : 22 : #include "includes.h" 23 : #include "librpc/gen_ndr/ndr_frsrpc.h" 24 : 25 0 : enum ndr_err_code ndr_push_frsrpc_CommPktChunkCtr(struct ndr_push *ndr, 26 : ndr_flags_type ndr_flags, 27 : const struct frsrpc_CommPktChunkCtr *r) 28 : { 29 0 : uint32_t cntr_chunks_0; 30 : { 31 0 : libndr_flags _flags_save_STRUCT = ndr->flags; 32 0 : ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN); 33 0 : if (ndr_flags & NDR_SCALARS) { 34 0 : NDR_CHECK(ndr_push_align(ndr, 2)); 35 0 : for (cntr_chunks_0 = 0; cntr_chunks_0 < r->num_chunks; cntr_chunks_0++) { 36 0 : NDR_CHECK(ndr_push_frsrpc_CommPktChunk(ndr, NDR_SCALARS, &r->chunks[cntr_chunks_0])); 37 : } 38 : } 39 0 : if (ndr_flags & NDR_BUFFERS) { 40 0 : } 41 0 : ndr->flags = _flags_save_STRUCT; 42 : } 43 0 : return NDR_ERR_SUCCESS; 44 : } 45 : 46 : #define _TMP_PULL_REALLOC_N(ndr, s, t, n) do { \ 47 : _NDR_PULL_FIX_CURRENT_MEM_CTX(ndr);\ 48 : (s) = talloc_realloc(ndr->current_mem_ctx, (s), t, n); \ 49 : if (!(s)) { \ 50 : return ndr_pull_error(ndr, NDR_ERR_ALLOC, \ 51 : "Alloc %u * %s failed: %s\n", \ 52 : (unsigned)n, # s, __location__); \ 53 : } \ 54 : } while (0) 55 : 56 0 : enum ndr_err_code ndr_pull_frsrpc_CommPktChunkCtr(struct ndr_pull *ndr, 57 : ndr_flags_type ndr_flags, 58 : struct frsrpc_CommPktChunkCtr *r) 59 : { 60 0 : uint32_t cntr_chunks_0; 61 : { 62 0 : libndr_flags _flags_save_STRUCT = ndr->flags; 63 0 : ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN); 64 0 : if (ndr_flags & NDR_SCALARS) { 65 0 : uint32_t remaining = ndr->data_size - ndr->offset; 66 0 : r->num_chunks = 0; 67 0 : r->chunks = NULL; 68 0 : for (cntr_chunks_0 = 0; remaining > 0; cntr_chunks_0++) { 69 0 : r->num_chunks += 1; 70 0 : _TMP_PULL_REALLOC_N(ndr, r->chunks, 71 : struct frsrpc_CommPktChunk, 72 : r->num_chunks); 73 0 : NDR_CHECK(ndr_pull_frsrpc_CommPktChunk(ndr, 74 : NDR_SCALARS, 75 : &r->chunks[cntr_chunks_0])); 76 0 : remaining = ndr->data_size - ndr->offset; 77 : } 78 : } 79 0 : if (ndr_flags & NDR_BUFFERS) { 80 0 : } 81 0 : ndr->flags = _flags_save_STRUCT; 82 : } 83 0 : return NDR_ERR_SUCCESS; 84 : } 85 : 86 0 : size_t ndr_size_frsrpc_CommPktChunkCtr(const struct frsrpc_CommPktChunkCtr *r, 87 : libndr_flags flags) 88 : { 89 0 : flags |= LIBNDR_FLAG_NOALIGN; 90 0 : return ndr_size_struct(r, flags, 91 : (ndr_push_flags_fn_t)ndr_push_frsrpc_CommPktChunkCtr); 92 : }