LCOV - code coverage report
Current view: top level - bin/default/librpc/gen_ndr - ndr_backupkey_c.c (source / functions) Hit Total Coverage
Test: coverage report for abartlet/fix-coverage dd10fb34 Lines: 3 93 3.2 %
Date: 2021-09-23 10:06:22 Functions: 1 8 12.5 %

          Line data    Source code
       1             : /* client functions auto-generated by pidl */
       2             : 
       3             : #include "includes.h"
       4             : #include <tevent.h>
       5             : #include "lib/util/tevent_ntstatus.h"
       6             : #include "bin/default/librpc/gen_ndr/ndr_backupkey.h"
       7             : #include "bin/default/librpc/gen_ndr/ndr_backupkey_c.h"
       8             : 
       9             : /* backupkey - client functions generated by pidl */
      10             : 
      11             : struct dcerpc_bkrp_BackupKey_r_state {
      12             :         TALLOC_CTX *out_mem_ctx;
      13             : };
      14             : 
      15             : static void dcerpc_bkrp_BackupKey_r_done(struct tevent_req *subreq);
      16             : 
      17           0 : struct tevent_req *dcerpc_bkrp_BackupKey_r_send(TALLOC_CTX *mem_ctx,
      18             :         struct tevent_context *ev,
      19             :         struct dcerpc_binding_handle *h,
      20             :         struct bkrp_BackupKey *r)
      21             : {
      22             :         struct tevent_req *req;
      23             :         struct dcerpc_bkrp_BackupKey_r_state *state;
      24             :         struct tevent_req *subreq;
      25             : 
      26           0 :         req = tevent_req_create(mem_ctx, &state,
      27             :                                 struct dcerpc_bkrp_BackupKey_r_state);
      28           0 :         if (req == NULL) {
      29           0 :                 return NULL;
      30             :         }
      31             : 
      32           0 :         state->out_mem_ctx = talloc_new(state);
      33           0 :         if (tevent_req_nomem(state->out_mem_ctx, req)) {
      34           0 :                 return tevent_req_post(req, ev);
      35             :         }
      36             : 
      37           0 :         subreq = dcerpc_binding_handle_call_send(state, ev, h,
      38             :                         NULL, &ndr_table_backupkey,
      39           0 :                         NDR_BKRP_BACKUPKEY, state->out_mem_ctx, r);
      40           0 :         if (tevent_req_nomem(subreq, req)) {
      41           0 :                 return tevent_req_post(req, ev);
      42             :         }
      43           0 :         tevent_req_set_callback(subreq, dcerpc_bkrp_BackupKey_r_done, req);
      44             : 
      45           0 :         return req;
      46             : }
      47             : 
      48           0 : static void dcerpc_bkrp_BackupKey_r_done(struct tevent_req *subreq)
      49             : {
      50           0 :         struct tevent_req *req =
      51           0 :                 tevent_req_callback_data(subreq,
      52             :                 struct tevent_req);
      53             :         NTSTATUS status;
      54             : 
      55           0 :         status = dcerpc_binding_handle_call_recv(subreq);
      56           0 :         TALLOC_FREE(subreq);
      57           0 :         if (tevent_req_nterror(req, status)) {
      58           0 :                 return;
      59             :         }
      60             : 
      61           0 :         tevent_req_done(req);
      62             : }
      63             : 
      64           0 : NTSTATUS dcerpc_bkrp_BackupKey_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
      65             : {
      66           0 :         struct dcerpc_bkrp_BackupKey_r_state *state =
      67           0 :                 tevent_req_data(req,
      68             :                 struct dcerpc_bkrp_BackupKey_r_state);
      69             :         NTSTATUS status;
      70             : 
      71           0 :         if (tevent_req_is_nterror(req, &status)) {
      72           0 :                 tevent_req_received(req);
      73           0 :                 return status;
      74             :         }
      75             : 
      76           0 :         talloc_steal(mem_ctx, state->out_mem_ctx);
      77             : 
      78           0 :         tevent_req_received(req);
      79           0 :         return NT_STATUS_OK;
      80             : }
      81             : 
      82         183 : NTSTATUS dcerpc_bkrp_BackupKey_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct bkrp_BackupKey *r)
      83             : {
      84             :         NTSTATUS status;
      85             : 
      86         183 :         status = dcerpc_binding_handle_call(h,
      87             :                         NULL, &ndr_table_backupkey,
      88             :                         NDR_BKRP_BACKUPKEY, mem_ctx, r);
      89             : 
      90         183 :         return status;
      91             : }
      92             : 
      93             : struct dcerpc_bkrp_BackupKey_state {
      94             :         struct bkrp_BackupKey orig;
      95             :         struct bkrp_BackupKey tmp;
      96             :         TALLOC_CTX *out_mem_ctx;
      97             : };
      98             : 
      99             : static void dcerpc_bkrp_BackupKey_done(struct tevent_req *subreq);
     100             : 
     101           0 : struct tevent_req *dcerpc_bkrp_BackupKey_send(TALLOC_CTX *mem_ctx,
     102             :                                               struct tevent_context *ev,
     103             :                                               struct dcerpc_binding_handle *h,
     104             :                                               struct GUID *_guidActionAgent /* [in] [ref] */,
     105             :                                               uint8_t *_data_in /* [in] [ref,size_is(data_in_len)] */,
     106             :                                               uint32_t _data_in_len /* [in]  */,
     107             :                                               uint8_t **_data_out /* [out] [ref,size_is(,*data_out_len)] */,
     108             :                                               uint32_t *_data_out_len /* [out] [ref] */,
     109             :                                               uint32_t _param /* [in]  */)
     110             : {
     111             :         struct tevent_req *req;
     112             :         struct dcerpc_bkrp_BackupKey_state *state;
     113             :         struct tevent_req *subreq;
     114             : 
     115           0 :         req = tevent_req_create(mem_ctx, &state,
     116             :                                 struct dcerpc_bkrp_BackupKey_state);
     117           0 :         if (req == NULL) {
     118           0 :                 return NULL;
     119             :         }
     120           0 :         state->out_mem_ctx = NULL;
     121             : 
     122             :         /* In parameters */
     123           0 :         state->orig.in.guidActionAgent = _guidActionAgent;
     124           0 :         state->orig.in.data_in = _data_in;
     125           0 :         state->orig.in.data_in_len = _data_in_len;
     126           0 :         state->orig.in.param = _param;
     127             : 
     128             :         /* Out parameters */
     129           0 :         state->orig.out.data_out = _data_out;
     130           0 :         state->orig.out.data_out_len = _data_out_len;
     131             : 
     132             :         /* Result */
     133           0 :         NDR_ZERO_STRUCT(state->orig.out.result);
     134             : 
     135           0 :         state->out_mem_ctx = talloc_named_const(state, 0,
     136             :                              "dcerpc_bkrp_BackupKey_out_memory");
     137           0 :         if (tevent_req_nomem(state->out_mem_ctx, req)) {
     138           0 :                 return tevent_req_post(req, ev);
     139             :         }
     140             : 
     141             :         /* make a temporary copy, that we pass to the dispatch function */
     142           0 :         state->tmp = state->orig;
     143             : 
     144           0 :         subreq = dcerpc_bkrp_BackupKey_r_send(state, ev, h, &state->tmp);
     145           0 :         if (tevent_req_nomem(subreq, req)) {
     146           0 :                 return tevent_req_post(req, ev);
     147             :         }
     148           0 :         tevent_req_set_callback(subreq, dcerpc_bkrp_BackupKey_done, req);
     149           0 :         return req;
     150             : }
     151             : 
     152           0 : static void dcerpc_bkrp_BackupKey_done(struct tevent_req *subreq)
     153             : {
     154           0 :         struct tevent_req *req = tevent_req_callback_data(
     155             :                 subreq, struct tevent_req);
     156           0 :         struct dcerpc_bkrp_BackupKey_state *state = tevent_req_data(
     157             :                 req, struct dcerpc_bkrp_BackupKey_state);
     158             :         NTSTATUS status;
     159             :         TALLOC_CTX *mem_ctx;
     160             : 
     161           0 :         if (state->out_mem_ctx) {
     162           0 :                 mem_ctx = state->out_mem_ctx;
     163             :         } else {
     164           0 :                 mem_ctx = state;
     165             :         }
     166             : 
     167           0 :         status = dcerpc_bkrp_BackupKey_r_recv(subreq, mem_ctx);
     168           0 :         TALLOC_FREE(subreq);
     169           0 :         if (tevent_req_nterror(req, status)) {
     170           0 :                 return;
     171             :         }
     172             : 
     173             :         /* Copy out parameters */
     174           0 :         *state->orig.out.data_out = *state->tmp.out.data_out;
     175           0 :         *state->orig.out.data_out_len = *state->tmp.out.data_out_len;
     176             : 
     177             :         /* Copy result */
     178           0 :         state->orig.out.result = state->tmp.out.result;
     179             : 
     180             :         /* Reset temporary structure */
     181           0 :         NDR_ZERO_STRUCT(state->tmp);
     182             : 
     183           0 :         tevent_req_done(req);
     184             : }
     185             : 
     186           0 : NTSTATUS dcerpc_bkrp_BackupKey_recv(struct tevent_req *req,
     187             :                                     TALLOC_CTX *mem_ctx,
     188             :                                     WERROR *result)
     189             : {
     190           0 :         struct dcerpc_bkrp_BackupKey_state *state = tevent_req_data(
     191             :                 req, struct dcerpc_bkrp_BackupKey_state);
     192             :         NTSTATUS status;
     193             : 
     194           0 :         if (tevent_req_is_nterror(req, &status)) {
     195           0 :                 tevent_req_received(req);
     196           0 :                 return status;
     197             :         }
     198             : 
     199             :         /* Steal possible out parameters to the callers context */
     200           0 :         talloc_steal(mem_ctx, state->out_mem_ctx);
     201             : 
     202             :         /* Return result */
     203           0 :         *result = state->orig.out.result;
     204             : 
     205           0 :         tevent_req_received(req);
     206           0 :         return NT_STATUS_OK;
     207             : }
     208             : 
     209           0 : NTSTATUS dcerpc_bkrp_BackupKey(struct dcerpc_binding_handle *h,
     210             :                                TALLOC_CTX *mem_ctx,
     211             :                                struct GUID *_guidActionAgent /* [in] [ref] */,
     212             :                                uint8_t *_data_in /* [in] [ref,size_is(data_in_len)] */,
     213             :                                uint32_t _data_in_len /* [in]  */,
     214             :                                uint8_t **_data_out /* [out] [ref,size_is(,*data_out_len)] */,
     215             :                                uint32_t *_data_out_len /* [out] [ref] */,
     216             :                                uint32_t _param /* [in]  */,
     217             :                                WERROR *result)
     218             : {
     219             :         struct bkrp_BackupKey r;
     220             :         NTSTATUS status;
     221             : 
     222             :         /* In parameters */
     223           0 :         r.in.guidActionAgent = _guidActionAgent;
     224           0 :         r.in.data_in = _data_in;
     225           0 :         r.in.data_in_len = _data_in_len;
     226           0 :         r.in.param = _param;
     227             : 
     228             :         /* Out parameters */
     229           0 :         r.out.data_out = _data_out;
     230           0 :         r.out.data_out_len = _data_out_len;
     231             : 
     232             :         /* Result */
     233           0 :         NDR_ZERO_STRUCT(r.out.result);
     234             : 
     235           0 :         status = dcerpc_bkrp_BackupKey_r(h, mem_ctx, &r);
     236           0 :         if (!NT_STATUS_IS_OK(status)) {
     237           0 :                 return status;
     238             :         }
     239             : 
     240             :         /* Return variables */
     241           0 :         *_data_out = *r.out.data_out;
     242           0 :         *_data_out_len = *r.out.data_out_len;
     243             : 
     244             :         /* Return result */
     245           0 :         *result = r.out.result;
     246             : 
     247           0 :         return NT_STATUS_OK;
     248             : }
     249             : 

Generated by: LCOV version 1.13