r1786: Add support for the 'helpstring' attribute on interfaces
[nivanova/samba-autobuild/.git] / source4 / 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 enum dcerpc_transport_t {NCACN_NP, NCACN_IP_TCP};
24
25 /*
26   this defines a generic security context for signed/sealed dcerpc pipes.
27 */
28 struct dcerpc_pipe;
29 struct dcerpc_security {
30         struct dcerpc_auth *auth_info;
31         struct gensec_security *generic_state;
32 };
33
34 struct dcerpc_pipe {
35         TALLOC_CTX *mem_ctx;
36         int reference_count;
37         uint32_t call_id;
38         uint32_t srv_max_xmit_frag;
39         uint32_t srv_max_recv_frag;
40         uint_t flags;
41         struct dcerpc_security security_state;
42         const char *binding_string;
43
44         struct dcerpc_syntax_id syntax;
45         struct dcerpc_syntax_id transfer_syntax;
46
47         struct dcerpc_transport {
48                 enum dcerpc_transport_t transport;
49                 void *private;
50                 NTSTATUS (*full_request)(struct dcerpc_pipe *, 
51                                          TALLOC_CTX *, DATA_BLOB *, DATA_BLOB *);
52                 NTSTATUS (*secondary_request)(struct dcerpc_pipe *, TALLOC_CTX *, DATA_BLOB *);
53                 NTSTATUS (*initial_request)(struct dcerpc_pipe *, TALLOC_CTX *, DATA_BLOB *);
54                 NTSTATUS (*shutdown_pipe)(struct dcerpc_pipe *);
55                 const char *(*peer_name)(struct dcerpc_pipe *);
56         } transport;
57
58         /* the last fault code from a DCERPC fault */
59         uint32_t last_fault_code;
60 };
61
62 /* dcerpc pipe flags */
63 #define DCERPC_DEBUG_PRINT_IN          (1<<0)
64 #define DCERPC_DEBUG_PRINT_OUT         (1<<1)
65 #define DCERPC_DEBUG_PRINT_BOTH (DCERPC_DEBUG_PRINT_IN | DCERPC_DEBUG_PRINT_OUT)
66
67 #define DCERPC_DEBUG_VALIDATE_IN       (1<<2)
68 #define DCERPC_DEBUG_VALIDATE_OUT      (1<<3)
69 #define DCERPC_DEBUG_VALIDATE_BOTH (DCERPC_DEBUG_VALIDATE_IN | DCERPC_DEBUG_VALIDATE_OUT)
70
71 #define DCERPC_SIGN                    (1<<4)
72 #define DCERPC_SEAL                    (1<<5)
73
74 #define DCERPC_PUSH_BIGENDIAN          (1<<6)
75 #define DCERPC_PULL_BIGENDIAN          (1<<7)
76
77 #define DCERPC_SCHANNEL_BDC            (1<<8)
78 #define DCERPC_SCHANNEL_WORKSTATION    (1<<9)
79 #define DCERPC_SCHANNEL_DOMAIN         (1<<10)
80 #define DCERPC_SCHANNEL_ANY            (DCERPC_SCHANNEL_BDC| \
81                                         DCERPC_SCHANNEL_DOMAIN| \
82                                         DCERPC_SCHANNEL_WORKSTATION)
83 /* use a 128 bit session key */
84 #define DCERPC_SCHANNEL_128            (1<<11)
85
86 #define DCERPC_AUTH_OPTIONS    (DCERPC_SEAL|DCERPC_SIGN|DCERPC_SCHANNEL_ANY)
87
88 /*
89   this is used to find pointers to calls
90 */
91 struct dcerpc_interface_call {
92         const char *name;
93         size_t struct_size;
94         NTSTATUS (*ndr_push)(struct ndr_push *, int , void *);
95         NTSTATUS (*ndr_pull)(struct ndr_pull *, int , void *);
96         void (*ndr_print)(struct ndr_print *, const char *, int, void *);       
97 };
98
99 struct dcerpc_endpoint_list {
100         uint32_t count;
101         const char * const *names;
102 };
103
104 struct dcerpc_interface_table {
105         const char *name;
106         const char *uuid;
107         uint32_t if_version;
108         const char *helpstring;
109         uint32_t num_calls;
110         const struct dcerpc_interface_call *calls;
111         const struct dcerpc_endpoint_list *endpoints;
112 };
113
114
115 /* this describes a binding to a particular transport/pipe */
116 struct dcerpc_binding {
117         enum dcerpc_transport_t transport;
118         const char *host;
119         const char **options;
120         uint32_t flags;
121 };