include/rpc_client.h

説明を見る。
00001 /* 
00002    Unix SMB/CIFS implementation.
00003    SMB parameters and setup
00004    Copyright (C) Gerald (Jerry) Carter         2005.
00005    
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; either version 2 of the License, or
00009    (at your option) any later version.
00010    
00011    This program is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014    GNU General Public License for more details.
00015    
00016    You should have received a copy of the GNU General Public License
00017    along with this program; if not, write to the Free Software
00018    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019 */
00020 
00021 #ifndef _RPC_CLIENT_H
00022 #define _RPC_CLIENT_H
00023 
00024 /* autogenerated client stubs */
00025 
00026 #include "librpc/gen_ndr/cli_wkssvc.h"
00027 
00028 /* macro to expand cookie-cutter code in cli_xxx() using rpc_api_pipe_req() */
00029 
00030 #define CLI_DO_RPC_INTERNAL( pcli, ctx, p_idx, opnum, q_in, r_out, \
00031                              q_ps, r_ps, q_io_fn, r_io_fn, default_error, copy_sess_key ) \
00032 {\
00033         SMB_ASSERT(pcli->pipe_idx == p_idx); \
00034         if (!prs_init( &q_ps, RPC_MAX_PDU_FRAG_LEN, ctx, MARSHALL )) { \
00035                 return NT_STATUS_NO_MEMORY;\
00036         }\
00037         if (!prs_init( &r_ps, 0, ctx, UNMARSHALL )) {\
00038                 prs_mem_free( &q_ps );\
00039                 return NT_STATUS_NO_MEMORY;\
00040         }\
00041         if ( copy_sess_key) prs_set_session_key(&q_ps, (const char *)pcli->dc->sess_key);\
00042         if ( q_io_fn("", &q_in, &q_ps, 0) ) {\
00043                 NTSTATUS _smb_pipe_stat_ = rpc_api_pipe_req(pcli, opnum, &q_ps, &r_ps); \
00044                 if (!NT_STATUS_IS_OK(_smb_pipe_stat_)) {\
00045                         prs_mem_free( &q_ps );\
00046                         prs_mem_free( &r_ps );\
00047                         return _smb_pipe_stat_;\
00048                 }\
00049                 if ( copy_sess_key ) prs_set_session_key(&r_ps, (const char *)pcli->dc->sess_key);\
00050                 if (!r_io_fn("", &r_out, &r_ps, 0)) {\
00051                         prs_mem_free( &q_ps );\
00052                         prs_mem_free( &r_ps );\
00053                         return default_error;\
00054                 }\
00055         } else {\
00056                 prs_mem_free( &q_ps );\
00057                 prs_mem_free( &r_ps );\
00058                 return default_error;\
00059         }\
00060         prs_mem_free( &q_ps );\
00061         prs_mem_free( &r_ps );\
00062 }
00063 
00064 #define CLI_DO_RPC_COPY_SESS_KEY( pcli, ctx, p_idx, opnum, q_in, r_out, \
00065                                   q_ps, r_ps, q_io_fn, r_io_fn, default_error ) \
00066 {\
00067         CLI_DO_RPC_INTERNAL( pcli, ctx, p_idx, opnum, q_in, r_out, \
00068                              q_ps, r_ps, q_io_fn, r_io_fn, default_error, True ); \
00069 }
00070 
00071 #define CLI_DO_RPC( pcli, ctx, p_idx, opnum, q_in, r_out, \
00072                     q_ps, r_ps, q_io_fn, r_io_fn, default_error ) \
00073 {\
00074         CLI_DO_RPC_INTERNAL( pcli, ctx, p_idx, opnum, q_in, r_out, \
00075                              q_ps, r_ps, q_io_fn, r_io_fn, default_error, False ); \
00076 }
00077 
00078 
00079 /* Arrrgg. Same but with WERRORS. Needed for registry code. */
00080 
00081 #define CLI_DO_RPC_WERR( pcli, ctx, p_idx, opnum, q_in, r_out, \
00082                              q_ps, r_ps, q_io_fn, r_io_fn, default_error ) \
00083 {\
00084         SMB_ASSERT(pcli->pipe_idx == p_idx); \
00085         if (!prs_init( &q_ps, RPC_MAX_PDU_FRAG_LEN, ctx, MARSHALL )) { \
00086                 return WERR_NOMEM;\
00087         }\
00088         if (!prs_init( &r_ps, 0, ctx, UNMARSHALL )) {\
00089                 prs_mem_free( &q_ps );\
00090                 return WERR_NOMEM;\
00091         }\
00092         if ( q_io_fn("", &q_in, &q_ps, 0) ) {\
00093                 NTSTATUS _smb_pipe_stat_ = rpc_api_pipe_req(pcli, opnum, &q_ps, &r_ps); \
00094                 if (!NT_STATUS_IS_OK(_smb_pipe_stat_)) {\
00095                         prs_mem_free( &q_ps );\
00096                         prs_mem_free( &r_ps );\
00097                         return ntstatus_to_werror(_smb_pipe_stat_);\
00098                 }\
00099                 if (!r_io_fn("", &r_out, &r_ps, 0)) {\
00100                         prs_mem_free( &q_ps );\
00101                         prs_mem_free( &r_ps );\
00102                         return default_error;\
00103                 }\
00104         } else {\
00105                 prs_mem_free( &q_ps );\
00106                 prs_mem_free( &r_ps );\
00107                 return default_error;\
00108         }\
00109         prs_mem_free( &q_ps );\
00110         prs_mem_free( &r_ps );\
00111 }
00112 
00113 #endif /* _RPC_CLIENT_H */

Sambaに対してSat Aug 29 21:22:55 2009に生成されました。  doxygen 1.4.7