LCOV - code coverage report
Current view: top level - bin/default/librpc/gen_ndr - ndr_printcap.c (source / functions) Hit Total Coverage
Test: coverage report for abartlet/fix-coverage dd10fb34 Lines: 26 166 15.7 %
Date: 2021-09-23 10:06:22 Functions: 1 7 14.3 %

          Line data    Source code
       1             : /* parser auto-generated by pidl */
       2             : 
       3             : #include "includes.h"
       4             : #include "bin/default/librpc/gen_ndr/ndr_printcap.h"
       5             : 
       6           0 : static enum ndr_err_code ndr_push_pcap_printer(struct ndr_push *ndr, int ndr_flags, const struct pcap_printer *r)
       7             : {
       8           0 :         NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
       9           0 :         if (ndr_flags & NDR_SCALARS) {
      10           0 :                 NDR_CHECK(ndr_push_align(ndr, 5));
      11           0 :                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->name));
      12           0 :                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->info));
      13           0 :                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->location));
      14           0 :                 NDR_CHECK(ndr_push_trailer_align(ndr, 5));
      15             :         }
      16           0 :         if (ndr_flags & NDR_BUFFERS) {
      17           0 :                 if (r->name) {
      18           0 :                         NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, ndr_charset_length(r->name, CH_UTF8)));
      19           0 :                         NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, 0));
      20           0 :                         NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, ndr_charset_length(r->name, CH_UTF8)));
      21           0 :                         NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->name, ndr_charset_length(r->name, CH_UTF8), sizeof(uint8_t), CH_UTF8));
      22             :                 }
      23           0 :                 if (r->info) {
      24           0 :                         NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, ndr_charset_length(r->info, CH_UTF8)));
      25           0 :                         NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, 0));
      26           0 :                         NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, ndr_charset_length(r->info, CH_UTF8)));
      27           0 :                         NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->info, ndr_charset_length(r->info, CH_UTF8), sizeof(uint8_t), CH_UTF8));
      28             :                 }
      29           0 :                 if (r->location) {
      30           0 :                         NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, ndr_charset_length(r->location, CH_UTF8)));
      31           0 :                         NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, 0));
      32           0 :                         NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, ndr_charset_length(r->location, CH_UTF8)));
      33           0 :                         NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->location, ndr_charset_length(r->location, CH_UTF8), sizeof(uint8_t), CH_UTF8));
      34             :                 }
      35             :         }
      36           0 :         return NDR_ERR_SUCCESS;
      37             : }
      38             : 
      39           0 : static enum ndr_err_code ndr_pull_pcap_printer(struct ndr_pull *ndr, int ndr_flags, struct pcap_printer *r)
      40             : {
      41             :         uint32_t _ptr_name;
      42           0 :         uint32_t size_name_1 = 0;
      43           0 :         uint32_t length_name_1 = 0;
      44           0 :         TALLOC_CTX *_mem_save_name_0 = NULL;
      45             :         uint32_t _ptr_info;
      46           0 :         uint32_t size_info_1 = 0;
      47           0 :         uint32_t length_info_1 = 0;
      48           0 :         TALLOC_CTX *_mem_save_info_0 = NULL;
      49             :         uint32_t _ptr_location;
      50           0 :         uint32_t size_location_1 = 0;
      51           0 :         uint32_t length_location_1 = 0;
      52           0 :         TALLOC_CTX *_mem_save_location_0 = NULL;
      53           0 :         NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
      54           0 :         if (ndr_flags & NDR_SCALARS) {
      55           0 :                 NDR_CHECK(ndr_pull_align(ndr, 5));
      56           0 :                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_name));
      57           0 :                 if (_ptr_name) {
      58           0 :                         NDR_PULL_ALLOC(ndr, r->name);
      59             :                 } else {
      60           0 :                         r->name = NULL;
      61             :                 }
      62           0 :                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_info));
      63           0 :                 if (_ptr_info) {
      64           0 :                         NDR_PULL_ALLOC(ndr, r->info);
      65             :                 } else {
      66           0 :                         r->info = NULL;
      67             :                 }
      68           0 :                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_location));
      69           0 :                 if (_ptr_location) {
      70           0 :                         NDR_PULL_ALLOC(ndr, r->location);
      71             :                 } else {
      72           0 :                         r->location = NULL;
      73             :                 }
      74           0 :                 NDR_CHECK(ndr_pull_trailer_align(ndr, 5));
      75             :         }
      76           0 :         if (ndr_flags & NDR_BUFFERS) {
      77           0 :                 if (r->name) {
      78           0 :                         _mem_save_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
      79           0 :                         NDR_PULL_SET_MEM_CTX(ndr, r->name, 0);
      80           0 :                         NDR_CHECK(ndr_pull_array_size(ndr, &r->name));
      81           0 :                         NDR_CHECK(ndr_pull_array_length(ndr, &r->name));
      82           0 :                         NDR_CHECK(ndr_steal_array_size(ndr, (void*)&r->name, &size_name_1));
      83           0 :                         NDR_CHECK(ndr_steal_array_length(ndr, (void*)&r->name, &length_name_1));
      84           0 :                         if (length_name_1 > size_name_1) {
      85           0 :                                 return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", size_name_1, length_name_1);
      86             :                         }
      87           0 :                         NDR_CHECK(ndr_check_string_terminator(ndr, length_name_1, sizeof(uint8_t)));
      88           0 :                         NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->name, length_name_1, sizeof(uint8_t), CH_UTF8));
      89           0 :                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_name_0, 0);
      90             :                 }
      91           0 :                 if (r->info) {
      92           0 :                         _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
      93           0 :                         NDR_PULL_SET_MEM_CTX(ndr, r->info, 0);
      94           0 :                         NDR_CHECK(ndr_pull_array_size(ndr, &r->info));
      95           0 :                         NDR_CHECK(ndr_pull_array_length(ndr, &r->info));
      96           0 :                         NDR_CHECK(ndr_steal_array_size(ndr, (void*)&r->info, &size_info_1));
      97           0 :                         NDR_CHECK(ndr_steal_array_length(ndr, (void*)&r->info, &length_info_1));
      98           0 :                         if (length_info_1 > size_info_1) {
      99           0 :                                 return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", size_info_1, length_info_1);
     100             :                         }
     101           0 :                         NDR_CHECK(ndr_check_string_terminator(ndr, length_info_1, sizeof(uint8_t)));
     102           0 :                         NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->info, length_info_1, sizeof(uint8_t), CH_UTF8));
     103           0 :                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, 0);
     104             :                 }
     105           0 :                 if (r->location) {
     106           0 :                         _mem_save_location_0 = NDR_PULL_GET_MEM_CTX(ndr);
     107           0 :                         NDR_PULL_SET_MEM_CTX(ndr, r->location, 0);
     108           0 :                         NDR_CHECK(ndr_pull_array_size(ndr, &r->location));
     109           0 :                         NDR_CHECK(ndr_pull_array_length(ndr, &r->location));
     110           0 :                         NDR_CHECK(ndr_steal_array_size(ndr, (void*)&r->location, &size_location_1));
     111           0 :                         NDR_CHECK(ndr_steal_array_length(ndr, (void*)&r->location, &length_location_1));
     112           0 :                         if (length_location_1 > size_location_1) {
     113           0 :                                 return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", size_location_1, length_location_1);
     114             :                         }
     115           0 :                         NDR_CHECK(ndr_check_string_terminator(ndr, length_location_1, sizeof(uint8_t)));
     116           0 :                         NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->location, length_location_1, sizeof(uint8_t), CH_UTF8));
     117           0 :                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_location_0, 0);
     118             :                 }
     119             :         }
     120           0 :         return NDR_ERR_SUCCESS;
     121             : }
     122             : 
     123           0 : _PUBLIC_ void ndr_print_pcap_printer(struct ndr_print *ndr, const char *name, const struct pcap_printer *r)
     124             : {
     125           0 :         ndr_print_struct(ndr, name, "pcap_printer");
     126           0 :         if (r == NULL) { ndr_print_null(ndr); return; }
     127           0 :         ndr->depth++;
     128           0 :         ndr_print_ptr(ndr, "name", r->name);
     129           0 :         ndr->depth++;
     130           0 :         if (r->name) {
     131           0 :                 ndr_print_string(ndr, "name", r->name);
     132             :         }
     133           0 :         ndr->depth--;
     134           0 :         ndr_print_ptr(ndr, "info", r->info);
     135           0 :         ndr->depth++;
     136           0 :         if (r->info) {
     137           0 :                 ndr_print_string(ndr, "info", r->info);
     138             :         }
     139           0 :         ndr->depth--;
     140           0 :         ndr_print_ptr(ndr, "location", r->location);
     141           0 :         ndr->depth++;
     142           0 :         if (r->location) {
     143           0 :                 ndr_print_string(ndr, "location", r->location);
     144             :         }
     145           0 :         ndr->depth--;
     146           0 :         ndr->depth--;
     147             : }
     148             : 
     149           0 : _PUBLIC_ enum ndr_err_code ndr_push_pcap_data(struct ndr_push *ndr, int ndr_flags, const struct pcap_data *r)
     150             : {
     151             :         uint32_t cntr_printers_0;
     152           0 :         NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
     153           0 :         if (ndr_flags & NDR_SCALARS) {
     154           0 :                 NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, r->count));
     155           0 :                 NDR_CHECK(ndr_push_align(ndr, 5));
     156           0 :                 NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->status));
     157           0 :                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
     158           0 :                 for (cntr_printers_0 = 0; cntr_printers_0 < (r->count); cntr_printers_0++) {
     159           0 :                         NDR_CHECK(ndr_push_pcap_printer(ndr, NDR_SCALARS, &r->printers[cntr_printers_0]));
     160             :                 }
     161           0 :                 NDR_CHECK(ndr_push_trailer_align(ndr, 5));
     162             :         }
     163           0 :         if (ndr_flags & NDR_BUFFERS) {
     164           0 :                 for (cntr_printers_0 = 0; cntr_printers_0 < (r->count); cntr_printers_0++) {
     165           0 :                         NDR_CHECK(ndr_push_pcap_printer(ndr, NDR_BUFFERS, &r->printers[cntr_printers_0]));
     166             :                 }
     167             :         }
     168           0 :         return NDR_ERR_SUCCESS;
     169             : }
     170             : 
     171          35 : _PUBLIC_ enum ndr_err_code ndr_pull_pcap_data(struct ndr_pull *ndr, int ndr_flags, struct pcap_data *r)
     172             : {
     173          35 :         uint32_t size_printers_0 = 0;
     174             :         uint32_t cntr_printers_0;
     175          35 :         TALLOC_CTX *_mem_save_printers_0 = NULL;
     176          35 :         NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
     177          35 :         if (ndr_flags & NDR_SCALARS) {
     178          35 :                 NDR_CHECK(ndr_pull_array_size(ndr, &r->printers));
     179          35 :                 NDR_CHECK(ndr_pull_align(ndr, 5));
     180          35 :                 NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->status));
     181          35 :                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->count));
     182          35 :                 NDR_CHECK(ndr_get_array_size(ndr, (void*)&r->printers, &size_printers_0));
     183          35 :                 NDR_PULL_ALLOC_N(ndr, r->printers, size_printers_0);
     184          35 :                 _mem_save_printers_0 = NDR_PULL_GET_MEM_CTX(ndr);
     185          35 :                 NDR_PULL_SET_MEM_CTX(ndr, r->printers, 0);
     186          35 :                 for (cntr_printers_0 = 0; cntr_printers_0 < (size_printers_0); cntr_printers_0++) {
     187           0 :                         NDR_CHECK(ndr_pull_pcap_printer(ndr, NDR_SCALARS, &r->printers[cntr_printers_0]));
     188             :                 }
     189          35 :                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_printers_0, 0);
     190          35 :                 if (r->printers) {
     191          35 :                         NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->printers, r->count));
     192             :                 }
     193          35 :                 NDR_CHECK(ndr_pull_trailer_align(ndr, 5));
     194             :         }
     195          35 :         if (ndr_flags & NDR_BUFFERS) {
     196          35 :                 NDR_CHECK(ndr_get_array_size(ndr, (void*)&r->printers, &size_printers_0));
     197          35 :                 _mem_save_printers_0 = NDR_PULL_GET_MEM_CTX(ndr);
     198          35 :                 NDR_PULL_SET_MEM_CTX(ndr, r->printers, 0);
     199          35 :                 for (cntr_printers_0 = 0; cntr_printers_0 < (size_printers_0); cntr_printers_0++) {
     200           0 :                         NDR_CHECK(ndr_pull_pcap_printer(ndr, NDR_BUFFERS, &r->printers[cntr_printers_0]));
     201             :                 }
     202          35 :                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_printers_0, 0);
     203          35 :                 for (cntr_printers_0 = 0; cntr_printers_0 < (size_printers_0); cntr_printers_0++) {
     204             :                 }
     205             :         }
     206          35 :         return NDR_ERR_SUCCESS;
     207             : }
     208             : 
     209           0 : static void ndr_print_flags_pcap_data(struct ndr_print *ndr, const char *name, int unused, const struct pcap_data *r)
     210             : {
     211           0 :         ndr_print_pcap_data(ndr, name, r);
     212           0 : }
     213             : 
     214           0 : _PUBLIC_ void ndr_print_pcap_data(struct ndr_print *ndr, const char *name, const struct pcap_data *r)
     215             : {
     216             :         uint32_t cntr_printers_0;
     217           0 :         ndr_print_struct(ndr, name, "pcap_data");
     218           0 :         if (r == NULL) { ndr_print_null(ndr); return; }
     219           0 :         ndr->depth++;
     220           0 :         ndr_print_NTSTATUS(ndr, "status", r->status);
     221           0 :         ndr_print_uint32(ndr, "count", r->count);
     222           0 :         ndr->print(ndr, "%s: ARRAY(%d)", "printers", (int)r->count);
     223           0 :         ndr->depth++;
     224           0 :         for (cntr_printers_0 = 0; cntr_printers_0 < (r->count); cntr_printers_0++) {
     225           0 :                 ndr_print_pcap_printer(ndr, "printers", &r->printers[cntr_printers_0]);
     226             :         }
     227           0 :         ndr->depth--;
     228           0 :         ndr->depth--;
     229             : }
     230             : 
     231             : #ifndef SKIP_NDR_TABLE_printcap
     232             : static const struct ndr_interface_public_struct printcap_public_structs[] = {
     233             :         {
     234             :                 .name = "pcap_data",
     235             :                 .struct_size = sizeof(struct pcap_data ),
     236             :                 .ndr_push = (ndr_push_flags_fn_t) ndr_push_pcap_data,
     237             :                 .ndr_pull = (ndr_pull_flags_fn_t) ndr_pull_pcap_data,
     238             :                 .ndr_print = (ndr_print_function_t) ndr_print_flags_pcap_data,
     239             :         },
     240             :         { .name = NULL }
     241             : };
     242             : 
     243             : static const struct ndr_interface_call printcap_calls[] = {
     244             :         { .name = NULL }
     245             : };
     246             : 
     247             : static const char * const printcap_endpoint_strings[] = {
     248             :         "ncacn_np:[\\pipe\\printcap]", 
     249             : };
     250             : 
     251             : static const struct ndr_interface_string_array printcap_endpoints = {
     252             :         .count  = 1,
     253             :         .names  = printcap_endpoint_strings
     254             : };
     255             : 
     256             : static const char * const printcap_authservice_strings[] = {
     257             :         "host", 
     258             : };
     259             : 
     260             : static const struct ndr_interface_string_array printcap_authservices = {
     261             :         .count  = 1,
     262             :         .names  = printcap_authservice_strings
     263             : };
     264             : 
     265             : 
     266             : const struct ndr_interface_table ndr_table_printcap = {
     267             :         .name           = "printcap",
     268             :         .num_calls      = 0,
     269             :         .calls          = printcap_calls,
     270             :         .num_public_structs     = 1,
     271             :         .public_structs         = printcap_public_structs,
     272             :         .endpoints      = &printcap_endpoints,
     273             :         .authservices   = &printcap_authservices
     274             : };
     275             : 
     276             : #endif /* SKIP_NDR_TABLE_printcap */

Generated by: LCOV version 1.13