d1acf64606c034b1681334285803ce30d28820c1
[metze/samba/wip.git] / librpc / rpc / dcerpc_connection.h
1 /*
2  *  Unix SMB/CIFS implementation.
3  *  DCERPC client routines
4  *
5  *  Copyright (C) Stefan Metzmacher 2011
6  *
7  *  This program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation; either version 3 of the License, or
10  *  (at your option) any later version.
11  *
12  *  This program is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *  GNU General Public License for more details.
16  *
17  *  You should have received a copy of the GNU General Public License
18  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
19  */
20
21 #ifndef _LIBRPC_RPC_DCERPC_CONNECTION_H_
22 #define _LIBRPC_RPC_DCERPC_CONNECTION_H_
23
24 struct tevent_context;
25 struct tstream_context;
26 struct gensec_security;
27 struct ndr_interface_table;
28
29 struct dcerpc_association;
30 struct dcerpc_connection;
31 struct dcerpc_security;
32 struct dcerpc_presentation;
33 struct dcerpc_call;
34
35 struct dcerpc_association *dcerpc_association_create(TALLOC_CTX *mem_ctx,
36                                                      uint16_t client_features);
37 struct dcerpc_connection *dcerpc_connection_create(TALLOC_CTX *mem_ctx,
38                                         struct dcerpc_association *assoc,
39                                         struct tstream_context **stream);
40 typedef NTSTATUS (*dcerpc_connection_use_trans_fn)(struct tstream_context *stream);
41 void dcerpc_connection_set_use_trans_fn(struct dcerpc_connection *conn,
42                                         dcerpc_connection_use_trans_fn fn);
43 struct dcerpc_security *dcerpc_security_allocate(
44                                         TALLOC_CTX *mem_ctx,
45                                         struct dcerpc_connection *conn,
46                                         enum dcerpc_AuthType auth_type,
47                                         enum dcerpc_AuthLevel auth_level,
48                                         struct gensec_security **gensec);
49 struct dcerpc_presentation *dcerpc_presentation_allocate(
50                                         TALLOC_CTX *mem_ctx,
51                                         struct dcerpc_connection *conn,
52                                         const struct ndr_interface_table *table,
53                                         const struct ndr_syntax_id *transfer);
54 struct dcerpc_presentation *dcerpc_presentation_test_copy(
55                                         TALLOC_CTX *mem_ctx,
56                                         const struct dcerpc_presentation *pres1,
57                                         const uint32_t *context_id,
58                                         const struct ndr_interface_table *table,
59                                         const struct ndr_syntax_id *transfer);
60 NTSTATUS dcerpc_presentation_status(const struct dcerpc_presentation *pres);
61 struct dcerpc_call *dcerpc_call_allocate(TALLOC_CTX *mem_ctx,
62                                          struct dcerpc_association *assoc,
63                                          struct dcerpc_security *sec,
64                                          struct dcerpc_presentation *pres);
65
66 struct tevent_req *dcerpc_do_bind_send(TALLOC_CTX *mem_ctx,
67                                 struct tevent_context *ev,
68                                 struct dcerpc_connection *conn,
69                                 struct dcerpc_call *call,
70                                 struct dcerpc_security *sec,
71                                 uint32_t num_pres,
72                                 struct dcerpc_presentation **pres);
73 NTSTATUS dcerpc_do_bind_recv(struct tevent_req *req);
74
75 struct tevent_req *dcerpc_do_request_send(TALLOC_CTX *mem_ctx,
76                                 struct tevent_context *ev,
77                                 struct dcerpc_connection *conn,
78                                 struct dcerpc_call *call,
79                                 const struct GUID *object,
80                                 uint16_t opnum,
81                                 const DATA_BLOB *request,
82                                 bool bigendian);
83 NTSTATUS dcerpc_do_request_recv(struct tevent_req *req,
84                                 TALLOC_CTX *mem_ctx,
85                                 DATA_BLOB *response,
86                                 bool *bigendian);
87
88 #endif /* _LIBRPC_RPC_DCERPC_CONNECTION_H_ */