2 Unix SMB/CIFS implementation.
4 common macros for the dcerpc server interfaces
6 Copyright (C) Stefan (metze) Metzmacher 2004
7 Copyright (C) Andrew Tridgell 2004
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>.
23 /* a useful macro for generating a RPC fault in the backend code */
24 #define DCESRV_FAULT(code) do { \
25 dce_call->fault_code = code; \
26 return r->out.result; \
29 /* a useful macro for generating a RPC fault in the backend code */
30 #define DCESRV_FAULT_VOID(code) do { \
31 dce_call->fault_code = code; \
35 /* a useful macro for checking the validity of a dcerpc policy handle
36 and giving the right fault code if invalid */
37 #define DCESRV_CHECK_HANDLE(h) do {if (!(h)) DCESRV_FAULT(DCERPC_FAULT_CONTEXT_MISMATCH); } while (0)
39 /* this checks for a valid policy handle, and gives a fault if an
40 invalid handle or retval if the handle is of the
42 #define DCESRV_PULL_HANDLE_RETVAL(h, inhandle, t, retval) do { \
43 (h) = dcesrv_handle_fetch(dce_call->context, (inhandle), DCESRV_HANDLE_ANY); \
44 DCESRV_CHECK_HANDLE(h); \
45 if ((t) != DCESRV_HANDLE_ANY && (h)->wire_handle.handle_type != (t)) { \
50 /* this checks for a valid policy handle and gives a dcerpc fault
51 if its the wrong type of handle */
52 #define DCESRV_PULL_HANDLE_FAULT(h, inhandle, t) do { \
53 (h) = dcesrv_handle_fetch(dce_call->context, (inhandle), t); \
54 DCESRV_CHECK_HANDLE(h); \
57 #define DCESRV_PULL_HANDLE(h, inhandle, t) DCESRV_PULL_HANDLE_RETVAL(h, inhandle, t, NT_STATUS_INVALID_HANDLE)
58 #define DCESRV_PULL_HANDLE_WERR(h, inhandle, t) DCESRV_PULL_HANDLE_RETVAL(h, inhandle, t, WERR_BADFID)
60 struct dcesrv_context;
62 #include "param/share.h"
63 #include "rpc_server/common/proto.h"