2 Unix SMB/CIFS implementation.
3 SMB parameters and setup
4 Copyright (C) Gerald (Jerry) Carter 2005.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
23 /* autogenerated client stubs */
25 #include "librpc/gen_ndr/cli_echo.h"
26 #include "librpc/gen_ndr/cli_lsa.h"
27 #include "librpc/gen_ndr/cli_svcctl.h"
28 #include "librpc/gen_ndr/cli_wkssvc.h"
29 #include "librpc/gen_ndr/cli_eventlog.h"
30 #include "librpc/gen_ndr/cli_dfs.h"
31 #include "librpc/gen_ndr/cli_initshutdown.h"
32 #include "librpc/gen_ndr/cli_winreg.h"
33 #include "librpc/gen_ndr/cli_srvsvc.h"
34 #include "librpc/gen_ndr/cli_samr.h"
35 #include "librpc/gen_ndr/cli_netlogon.h"
36 #include "librpc/gen_ndr/cli_dssetup.h"
37 #include "librpc/gen_ndr/cli_ntsvcs.h"
38 #include "librpc/gen_ndr/cli_epmapper.h"
39 #include "librpc/gen_ndr/cli_drsuapi.h"
41 #define prs_init_empty( _ps_, _ctx_, _io_ ) (void) prs_init((_ps_), 0, (_ctx_), (_io_))
43 /* macro to expand cookie-cutter code in cli_xxx() using rpc_api_pipe_req() */
45 #define CLI_DO_RPC_INTERNAL( pcli, ctx, p_idx, opnum, q_in, r_out, \
46 q_ps, r_ps, q_io_fn, r_io_fn, default_error, copy_sess_key ) \
48 SMB_ASSERT(pcli->pipe_idx == p_idx); \
49 if (!prs_init( &q_ps, RPC_MAX_PDU_FRAG_LEN, ctx, MARSHALL )) { \
50 return NT_STATUS_NO_MEMORY;\
52 prs_init_empty( &r_ps, ctx, UNMARSHALL );\
53 if ( copy_sess_key) prs_set_session_key(&q_ps, (const char *)pcli->dc->sess_key);\
54 if ( q_io_fn("", &q_in, &q_ps, 0) ) {\
55 NTSTATUS _smb_pipe_stat_ = rpc_api_pipe_req(pcli, opnum, &q_ps, &r_ps); \
56 if (!NT_STATUS_IS_OK(_smb_pipe_stat_)) {\
57 prs_mem_free( &q_ps );\
58 prs_mem_free( &r_ps );\
59 return _smb_pipe_stat_;\
61 if ( copy_sess_key ) prs_set_session_key(&r_ps, (const char *)pcli->dc->sess_key);\
62 if (!r_io_fn("", &r_out, &r_ps, 0)) {\
63 prs_mem_free( &q_ps );\
64 prs_mem_free( &r_ps );\
65 return default_error;\
68 prs_mem_free( &q_ps );\
69 prs_mem_free( &r_ps );\
70 return default_error;\
72 prs_mem_free( &q_ps );\
73 prs_mem_free( &r_ps );\
76 #define CLI_DO_RPC_COPY_SESS_KEY( pcli, ctx, p_idx, opnum, q_in, r_out, \
77 q_ps, r_ps, q_io_fn, r_io_fn, default_error ) \
79 CLI_DO_RPC_INTERNAL( pcli, ctx, p_idx, opnum, q_in, r_out, \
80 q_ps, r_ps, q_io_fn, r_io_fn, default_error, True ); \
83 #define CLI_DO_RPC( pcli, ctx, p_idx, opnum, q_in, r_out, \
84 q_ps, r_ps, q_io_fn, r_io_fn, default_error ) \
86 CLI_DO_RPC_INTERNAL( pcli, ctx, p_idx, opnum, q_in, r_out, \
87 q_ps, r_ps, q_io_fn, r_io_fn, default_error, False ); \
91 /* Arrrgg. Same but with WERRORS. Needed for registry code. */
93 #define CLI_DO_RPC_WERR( pcli, ctx, p_idx, opnum, q_in, r_out, \
94 q_ps, r_ps, q_io_fn, r_io_fn, default_error ) \
96 SMB_ASSERT(rpccli_is_pipe_idx(pcli, p_idx)); \
97 if (!prs_init( &q_ps, RPC_MAX_PDU_FRAG_LEN, ctx, MARSHALL )) { \
100 prs_init_empty( &r_ps, ctx, UNMARSHALL );\
101 if ( q_io_fn("", &q_in, &q_ps, 0) ) {\
102 NTSTATUS _smb_pipe_stat_ = rpc_api_pipe_req(pcli, opnum, &q_ps, &r_ps); \
103 if (!NT_STATUS_IS_OK(_smb_pipe_stat_)) {\
104 prs_mem_free( &q_ps );\
105 prs_mem_free( &r_ps );\
106 return ntstatus_to_werror(_smb_pipe_stat_);\
108 if (!r_io_fn("", &r_out, &r_ps, 0)) {\
109 prs_mem_free( &q_ps );\
110 prs_mem_free( &r_ps );\
111 return default_error;\
114 prs_mem_free( &q_ps );\
115 prs_mem_free( &r_ps );\
116 return default_error;\
118 prs_mem_free( &q_ps );\
119 prs_mem_free( &r_ps );\
122 #endif /* _RPC_CLIENT_H */