LCOV - code coverage report
Current view: top level - librpc/ndr - ndr_witness.c (source / functions) Hit Total Coverage
Test: coverage report for support-claim-type-attributes 6b5c566e Lines: 62 63 98.4 %
Date: 2023-11-21 12:31:41 Functions: 2 2 100.0 %

          Line data    Source code
       1             : /*
       2             :    Unix SMB/CIFS implementation.
       3             : 
       4             :    routines for marshalling/unmarshalling witness structures
       5             : 
       6             :    Copyright (C) Guenther Deschner 2015
       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_witness.h"
      24             : 
      25          24 : _PUBLIC_ enum ndr_err_code ndr_push_witness_notifyResponse(struct ndr_push *ndr, ndr_flags_type ndr_flags, const struct witness_notifyResponse *r)
      26             : {
      27          24 :         uint32_t cntr_messages_0;
      28             :         {
      29          24 :                 libndr_flags _flags_save_STRUCT = ndr->flags;
      30          24 :                 ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
      31          24 :                 NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
      32          24 :                 if (ndr_flags & NDR_SCALARS) {
      33          24 :                         NDR_CHECK(ndr_push_align(ndr, 4));
      34          24 :                         NDR_CHECK(ndr_push_witness_notifyResponse_type(ndr, NDR_SCALARS, r->type));
      35          24 :                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_size_witness_notifyResponse(r, ndr->flags) - 20));
      36          24 :                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num));
      37          24 :                         NDR_CHECK(ndr_push_unique_ptr(ndr, r->messages));
      38          24 :                         if (r->messages) {
      39          24 :                                 libndr_flags _flags_save_witness_notifyResponse_message = ndr->flags;
      40          24 :                                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
      41             :                                         {
      42          24 :                                                 struct ndr_push *_ndr_messages;
      43          24 :                                                 NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_messages, 4, ndr_size_witness_notifyResponse(r, ndr->flags) - 20));
      44          48 :                                                 for (cntr_messages_0 = 0; cntr_messages_0 < (r->num); cntr_messages_0++) {
      45          24 :                                                         NDR_CHECK(ndr_push_set_switch_value(_ndr_messages, &r->messages[cntr_messages_0], r->type));
      46          24 :                                                         NDR_CHECK(ndr_push_witness_notifyResponse_message(_ndr_messages, NDR_SCALARS, &r->messages[cntr_messages_0]));
      47             :                                                 }
      48          24 :                                                 NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_messages, 4, ndr_size_witness_notifyResponse(r, ndr->flags) - 20));
      49             :                                         }
      50          24 :                                 ndr->flags = _flags_save_witness_notifyResponse_message;
      51             :                         }
      52          24 :                         NDR_CHECK(ndr_push_trailer_align(ndr, 4));
      53             :                 }
      54          24 :                 if (ndr_flags & NDR_BUFFERS) {
      55          24 :                 }
      56          24 :                 ndr->flags = _flags_save_STRUCT;
      57             :         }
      58          24 :         return NDR_ERR_SUCCESS;
      59             : }
      60             : 
      61          10 : _PUBLIC_ enum ndr_err_code ndr_pull_witness_notifyResponse(struct ndr_pull *ndr, ndr_flags_type ndr_flags, struct witness_notifyResponse *r)
      62             : {
      63          10 :         libndr_flags _flags_save_STRUCT = ndr->flags;
      64          10 :         ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
      65          10 :         NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
      66          10 :         if (ndr_flags & NDR_SCALARS) {
      67          10 :                 NDR_CHECK(ndr_pull_align(ndr, 4));
      68          10 :                 NDR_CHECK(ndr_pull_witness_notifyResponse_type(ndr, NDR_SCALARS, &r->type));
      69          10 :                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->length));
      70          10 :                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->num));
      71             :                 {
      72          10 :                         libndr_flags _flags_save_witness_notifyResponse_message = ndr->flags;
      73          10 :                         uint32_t _ptr_messages;
      74          10 :                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
      75          10 :                         NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_messages));
      76          10 :                         if (_ptr_messages) {
      77          10 :                                 NDR_PULL_ALLOC(ndr, r->messages);
      78             :                         } else {
      79           0 :                                 r->messages = NULL;
      80             :                         }
      81          10 :                         if (r->messages) {
      82          10 :                                 uint32_t size_messages_0 = 0;
      83          10 :                                 uint32_t cntr_messages_0;
      84          10 :                                 TALLOC_CTX *_mem_save_messages_0;
      85             : 
      86          10 :                                 size_messages_0 = r->num;
      87          10 :                                 NDR_PULL_ALLOC_N(ndr, r->messages, size_messages_0);
      88          10 :                                 _mem_save_messages_0 = NDR_PULL_GET_MEM_CTX(ndr);
      89          10 :                                 NDR_PULL_SET_MEM_CTX(ndr, r->messages, 0);
      90             :                                 {
      91          10 :                                         struct ndr_pull *_ndr_messages;
      92          10 :                                         NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_messages, 4, r->length));
      93          20 :                                         for (cntr_messages_0 = 0; cntr_messages_0 < (size_messages_0); cntr_messages_0++) {
      94          10 :                                                 NDR_CHECK(ndr_pull_set_switch_value(_ndr_messages, &r->messages[cntr_messages_0], r->type));
      95          10 :                                                 NDR_CHECK(ndr_pull_witness_notifyResponse_message(_ndr_messages, NDR_SCALARS, &r->messages[cntr_messages_0]));
      96             :                                         }
      97          10 :                                         NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_messages, 4, r->length));
      98             :                                 }
      99          10 :                                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_messages_0, 0);
     100             :                         }
     101          10 :                         ndr->flags = _flags_save_witness_notifyResponse_message;
     102             :                 }
     103          10 :                 NDR_CHECK(ndr_pull_trailer_align(ndr, 4));
     104             :         }
     105          10 :         if (ndr_flags & NDR_BUFFERS) {
     106          10 :         }
     107          10 :         ndr->flags = _flags_save_STRUCT;
     108             : 
     109          10 :         return NDR_ERR_SUCCESS;
     110             : }

Generated by: LCOV version 1.14