added code to the RPC-SPOOLSS test that demonstrates that policy
[jelmer/samba4-debian.git] / source / librpc / rpc / dcerpc.h
1 /* 
2    Unix SMB/CIFS implementation.
3    DCERPC interface structures
4
5    Copyright (C) Tim Potter 2003
6    Copyright (C) Andrew Tridgell 2003
7    
8    This program is free software; you can redistribute it and/or modify
9    it under the terms of the GNU General Public License as published by
10    the Free Software Foundation; either version 2 of the License, or
11    (at your option) any later version.
12    
13    This program is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16    GNU General Public License for more details.
17    
18    You should have received a copy of the GNU General Public License
19    along with this program; if not, write to the Free Software
20    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23 /*
24   see http://www.opengroup.org/onlinepubs/9629399/chap12.htm for details
25   of these structures
26
27   note that the structure definitions here don't include some of the
28   fields that are wire-artifacts. Those are put on the wire by the
29   marshalling/unmarshalling routines in decrpc.c
30 */
31
32 enum dcerpc_transport_t {NCACN_NP, NCACN_IP_TCP};
33
34
35 struct dcerpc_pipe {
36         TALLOC_CTX *mem_ctx;
37         int reference_count;
38         uint32 call_id;
39         uint32 srv_max_xmit_frag;
40         uint32 srv_max_recv_frag;
41         unsigned flags;
42         struct ntlmssp_state *ntlmssp_state;
43         struct dcerpc_auth *auth_info;
44         const char *binding_string;
45         
46         struct dcerpc_transport {
47                 enum dcerpc_transport_t transport;
48                 void *private;
49                 NTSTATUS (*full_request)(struct dcerpc_pipe *, 
50                                          TALLOC_CTX *, DATA_BLOB *, DATA_BLOB *);
51                 NTSTATUS (*secondary_request)(struct dcerpc_pipe *, TALLOC_CTX *, DATA_BLOB *);
52                 NTSTATUS (*initial_request)(struct dcerpc_pipe *, TALLOC_CTX *, DATA_BLOB *);
53                 NTSTATUS (*shutdown_pipe)(struct dcerpc_pipe *);
54                 const char *(*peer_name)(struct dcerpc_pipe *);
55         } transport;
56
57         /* the last fault code from a DCERPC fault */
58         uint32 last_fault_code;
59 };
60
61 /* dcerpc pipe flags */
62 #define DCERPC_DEBUG_PRINT_IN  (1<<0)
63 #define DCERPC_DEBUG_PRINT_OUT (1<<1)
64 #define DCERPC_DEBUG_PRINT_BOTH (DCERPC_DEBUG_PRINT_IN | DCERPC_DEBUG_PRINT_OUT)
65
66 #define DCERPC_DEBUG_VALIDATE_IN  4
67 #define DCERPC_DEBUG_VALIDATE_OUT 8
68 #define DCERPC_DEBUG_VALIDATE_BOTH (DCERPC_DEBUG_VALIDATE_IN | DCERPC_DEBUG_VALIDATE_OUT)
69
70 #define DCERPC_SIGN            16
71 #define DCERPC_SEAL            32
72
73 #define DCERPC_PUSH_BIGENDIAN   64
74 #define DCERPC_PULL_BIGENDIAN  128
75
76 /*
77   this is used to find pointers to calls
78 */
79 struct dcerpc_interface_call {
80         const char *name;
81         size_t struct_size;
82         NTSTATUS (*ndr_push)(struct ndr_push *, int , void *);
83         NTSTATUS (*ndr_pull)(struct ndr_pull *, int , void *);
84         void (*ndr_print)(struct ndr_print *, const char *, int, void *);       
85 };
86
87 struct dcerpc_endpoint_list {
88         uint32 count;
89         const char **names;
90 };
91
92 struct dcerpc_interface_table {
93         const char *name;
94         const char *uuid;
95         uint32 if_version;
96         uint32 num_calls;
97         const struct dcerpc_interface_call *calls;
98         const struct dcerpc_endpoint_list *endpoints;
99 };
100
101
102 /* this describes a binding to a particular transport/pipe */
103 struct dcerpc_binding {
104         enum dcerpc_transport_t transport;
105         const char *host;
106         const char **options;
107         uint32 flags;
108 };