summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--librpc/rpc/rpc_common.h103
-rw-r--r--source3/librpc/rpc/dcerpc.h146
-rw-r--r--source4/librpc/rpc/dcerpc.h122
-rwxr-xr-xsource4/librpc/wscript_build5
4 files changed, 107 insertions, 269 deletions
diff --git a/librpc/rpc/rpc_common.h b/librpc/rpc/rpc_common.h
index 3f5216bdec..5d1bde00e0 100644
--- a/librpc/rpc/rpc_common.h
+++ b/librpc/rpc/rpc_common.h
@@ -1,8 +1,41 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ Copyright (C) Stefan Metzmacher 2010-2011
+ Copyright (C) Andrew Tridgell 2010-2011
+ Copyright (C) Simo Sorce 2010
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
#ifndef __DEFAULT_LIBRPC_RPCCOMMON_H__
#define __DEFAULT_LIBRPC_RPCCOMMON_H__
+struct dcerpc_binding_handle;
+struct GUID;
+struct ndr_interface_table;
+struct ndr_interface_call;
+struct ndr_push;
+struct ndr_pull;
+struct ncacn_packet;
+struct tevent_context;
+struct tstream_context;
+
/* The following definitions come from ../librpc/rpc/dcerpc_error.c */
+const char *dcerpc_errstr(TALLOC_CTX *mem_ctx, uint32_t fault_code);
+NTSTATUS dcerpc_fault_to_nt_status(uint32_t fault_code);
/* The following definitions come from ../librpc/rpc/binding.c */
@@ -52,6 +85,58 @@ NTSTATUS dcerpc_read_ncacn_packet_recv(struct tevent_req *req,
/* The following definitions come from ../librpc/rpc/binding_handle.c */
+struct dcerpc_binding_handle_ops {
+ const char *name;
+
+ bool (*is_connected)(struct dcerpc_binding_handle *h);
+ uint32_t (*set_timeout)(struct dcerpc_binding_handle *h,
+ uint32_t timeout);
+
+ struct tevent_req *(*raw_call_send)(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct dcerpc_binding_handle *h,
+ const struct GUID *object,
+ uint32_t opnum,
+ uint32_t in_flags,
+ const uint8_t *in_data,
+ size_t in_length);
+ NTSTATUS (*raw_call_recv)(struct tevent_req *req,
+ TALLOC_CTX *mem_ctx,
+ uint8_t **out_data,
+ size_t *out_length,
+ uint32_t *out_flags);
+
+ struct tevent_req *(*disconnect_send)(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct dcerpc_binding_handle *h);
+ NTSTATUS (*disconnect_recv)(struct tevent_req *req);
+
+ /* TODO: remove the following functions */
+ bool (*push_bigendian)(struct dcerpc_binding_handle *h);
+ bool (*ref_alloc)(struct dcerpc_binding_handle *h);
+ bool (*use_ndr64)(struct dcerpc_binding_handle *h);
+ void (*do_ndr_print)(struct dcerpc_binding_handle *h,
+ int ndr_flags,
+ const void *struct_ptr,
+ const struct ndr_interface_call *call);
+ void (*ndr_push_failed)(struct dcerpc_binding_handle *h,
+ NTSTATUS error,
+ const void *struct_ptr,
+ const struct ndr_interface_call *call);
+ void (*ndr_pull_failed)(struct dcerpc_binding_handle *h,
+ NTSTATUS error,
+ const DATA_BLOB *blob,
+ const struct ndr_interface_call *call);
+ NTSTATUS (*ndr_validate_in)(struct dcerpc_binding_handle *h,
+ TALLOC_CTX *mem_ctx,
+ const DATA_BLOB *blob,
+ const struct ndr_interface_call *call);
+ NTSTATUS (*ndr_validate_out)(struct dcerpc_binding_handle *h,
+ struct ndr_pull *pull_in,
+ const void *struct_ptr,
+ const struct ndr_interface_call *call);
+};
+
struct dcerpc_binding_handle *_dcerpc_binding_handle_create(TALLOC_CTX *mem_ctx,
const struct dcerpc_binding_handle_ops *ops,
const struct GUID *object,
@@ -60,12 +145,23 @@ struct dcerpc_binding_handle *_dcerpc_binding_handle_create(TALLOC_CTX *mem_ctx,
size_t psize,
const char *type,
const char *location);
+#define dcerpc_binding_handle_create(mem_ctx, ops, object, table, \
+ state, type, location) \
+ _dcerpc_binding_handle_create(mem_ctx, ops, object, table, \
+ state, sizeof(type), #type, location)
+
void *_dcerpc_binding_handle_data(struct dcerpc_binding_handle *h);
-void dcerpc_binding_handle_set_sync_ev(struct dcerpc_binding_handle *h,
- struct tevent_context *ev);
+#define dcerpc_binding_handle_data(_h, _type) \
+ talloc_get_type_abort(_dcerpc_binding_handle_data(_h), _type)
+
+_DEPRECATED_ void dcerpc_binding_handle_set_sync_ev(struct dcerpc_binding_handle *h,
+ struct tevent_context *ev);
+
bool dcerpc_binding_handle_is_connected(struct dcerpc_binding_handle *h);
+
uint32_t dcerpc_binding_handle_set_timeout(struct dcerpc_binding_handle *h,
uint32_t timeout);
+
struct tevent_req *dcerpc_binding_handle_raw_call_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
struct dcerpc_binding_handle *h,
@@ -79,10 +175,12 @@ NTSTATUS dcerpc_binding_handle_raw_call_recv(struct tevent_req *req,
uint8_t **out_data,
size_t *out_length,
uint32_t *out_flags);
+
struct tevent_req *dcerpc_binding_handle_disconnect_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
struct dcerpc_binding_handle *h);
NTSTATUS dcerpc_binding_handle_disconnect_recv(struct tevent_req *req);
+
struct tevent_req *dcerpc_binding_handle_call_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
struct dcerpc_binding_handle *h,
@@ -98,4 +196,5 @@ NTSTATUS dcerpc_binding_handle_call(struct dcerpc_binding_handle *h,
uint32_t opnum,
TALLOC_CTX *r_mem,
void *r_ptr);
+
#endif /* __DEFAULT_LIBRPC_RPCCOMMON_H__ */
diff --git a/source3/librpc/rpc/dcerpc.h b/source3/librpc/rpc/dcerpc.h
index 71228bcdef..3cfd229f33 100644
--- a/source3/librpc/rpc/dcerpc.h
+++ b/source3/librpc/rpc/dcerpc.h
@@ -162,150 +162,6 @@ NTSTATUS dcerpc_check_auth(struct pipe_auth_data *auth,
DATA_BLOB *raw_pkt,
size_t *pad_len);
-struct dcerpc_binding_handle;
-struct GUID;
-struct ndr_interface_table;
-struct ndr_interface_call;
-struct ndr_push;
-struct ndr_pull;
-struct tevent_context;
-struct tstream_context;
-
-/* The following definitions come from ../librpc/rpc/dcerpc_util.c */
-
-void dcerpc_set_frag_length(DATA_BLOB *blob, uint16_t v);
-uint16_t dcerpc_get_frag_length(const DATA_BLOB *blob);
-void dcerpc_set_auth_length(DATA_BLOB *blob, uint16_t v);
-struct tevent_req *dcerpc_read_ncacn_packet_send(TALLOC_CTX *mem_ctx,
- struct tevent_context *ev,
- struct tstream_context *stream);
-NTSTATUS dcerpc_read_ncacn_packet_recv(struct tevent_req *req,
- TALLOC_CTX *mem_ctx,
- struct ncacn_packet **pkt,
- DATA_BLOB *buffer);
-uint8_t dcerpc_get_endian_flag(DATA_BLOB *blob);
-NTSTATUS dcerpc_pull_auth_trailer(struct ncacn_packet *pkt,
- TALLOC_CTX *mem_ctx,
- DATA_BLOB *pkt_trailer,
- struct dcerpc_auth *auth,
- uint32_t *auth_length,
- bool auth_data_only);
-
-/* The following definitions come from ../librpc/rpc/dcerpc_error.c */
-
-const char *dcerpc_errstr(TALLOC_CTX *mem_ctx, uint32_t fault_code);
-NTSTATUS dcerpc_fault_to_nt_status(uint32_t fault_code);
-
-struct dcerpc_binding_handle_ops {
- const char *name;
-
- bool (*is_connected)(struct dcerpc_binding_handle *h);
- uint32_t (*set_timeout)(struct dcerpc_binding_handle *h,
- uint32_t timeout);
-
- struct tevent_req *(*raw_call_send)(TALLOC_CTX *mem_ctx,
- struct tevent_context *ev,
- struct dcerpc_binding_handle *h,
- const struct GUID *object,
- uint32_t opnum,
- uint32_t in_flags,
- const uint8_t *in_data,
- size_t in_length);
- NTSTATUS (*raw_call_recv)(struct tevent_req *req,
- TALLOC_CTX *mem_ctx,
- uint8_t **out_data,
- size_t *out_length,
- uint32_t *out_flags);
-
- struct tevent_req *(*disconnect_send)(TALLOC_CTX *mem_ctx,
- struct tevent_context *ev,
- struct dcerpc_binding_handle *h);
- NTSTATUS (*disconnect_recv)(struct tevent_req *req);
-
- /* TODO: remove the following functions */
- bool (*push_bigendian)(struct dcerpc_binding_handle *h);
- bool (*ref_alloc)(struct dcerpc_binding_handle *h);
- bool (*use_ndr64)(struct dcerpc_binding_handle *h);
- void (*do_ndr_print)(struct dcerpc_binding_handle *h,
- int ndr_flags,
- const void *struct_ptr,
- const struct ndr_interface_call *call);
- void (*ndr_push_failed)(struct dcerpc_binding_handle *h,
- NTSTATUS error,
- const void *struct_ptr,
- const struct ndr_interface_call *call);
- void (*ndr_pull_failed)(struct dcerpc_binding_handle *h,
- NTSTATUS error,
- const DATA_BLOB *blob,
- const struct ndr_interface_call *call);
- NTSTATUS (*ndr_validate_in)(struct dcerpc_binding_handle *h,
- TALLOC_CTX *mem_ctx,
- const DATA_BLOB *blob,
- const struct ndr_interface_call *call);
- NTSTATUS (*ndr_validate_out)(struct dcerpc_binding_handle *h,
- struct ndr_pull *pull_in,
- const void *struct_ptr,
- const struct ndr_interface_call *call);
-};
-
-struct dcerpc_binding_handle *_dcerpc_binding_handle_create(TALLOC_CTX *mem_ctx,
- const struct dcerpc_binding_handle_ops *ops,
- const struct GUID *object,
- const struct ndr_interface_table *table,
- void *pstate,
- size_t psize,
- const char *type,
- const char *location);
-#define dcerpc_binding_handle_create(mem_ctx, ops, object, table, \
- state, type, location) \
- _dcerpc_binding_handle_create(mem_ctx, ops, object, table, \
- state, sizeof(type), #type, location)
-
-void *_dcerpc_binding_handle_data(struct dcerpc_binding_handle *h);
-#define dcerpc_binding_handle_data(_h, _type) \
- talloc_get_type_abort(_dcerpc_binding_handle_data(_h), _type)
-
-_DEPRECATED_ void dcerpc_binding_handle_set_sync_ev(struct dcerpc_binding_handle *h,
- struct tevent_context *ev);
-
-bool dcerpc_binding_handle_is_connected(struct dcerpc_binding_handle *h);
-
-uint32_t dcerpc_binding_handle_set_timeout(struct dcerpc_binding_handle *h,
- uint32_t timeout);
-
-struct tevent_req *dcerpc_binding_handle_raw_call_send(TALLOC_CTX *mem_ctx,
- struct tevent_context *ev,
- struct dcerpc_binding_handle *h,
- const struct GUID *object,
- uint32_t opnum,
- uint32_t in_flags,
- const uint8_t *in_data,
- size_t in_length);
-NTSTATUS dcerpc_binding_handle_raw_call_recv(struct tevent_req *req,
- TALLOC_CTX *mem_ctx,
- uint8_t **out_data,
- size_t *out_length,
- uint32_t *out_flags);
-
-struct tevent_req *dcerpc_binding_handle_disconnect_send(TALLOC_CTX *mem_ctx,
- struct tevent_context *ev,
- struct dcerpc_binding_handle *h);
-NTSTATUS dcerpc_binding_handle_disconnect_recv(struct tevent_req *req);
-
-struct tevent_req *dcerpc_binding_handle_call_send(TALLOC_CTX *mem_ctx,
- struct tevent_context *ev,
- struct dcerpc_binding_handle *h,
- const struct GUID *object,
- const struct ndr_interface_table *table,
- uint32_t opnum,
- TALLOC_CTX *r_mem,
- void *r_ptr);
-NTSTATUS dcerpc_binding_handle_call_recv(struct tevent_req *req);
-NTSTATUS dcerpc_binding_handle_call(struct dcerpc_binding_handle *h,
- const struct GUID *object,
- const struct ndr_interface_table *table,
- uint32_t opnum,
- TALLOC_CTX *r_mem,
- void *r_ptr);
+#include "../librpc/rpc/rpc_common.h"
#endif /* __DCERPC_H__ */
diff --git a/source4/librpc/rpc/dcerpc.h b/source4/librpc/rpc/dcerpc.h
index 2369a4c35b..bff7f6e1bb 100644
--- a/source4/librpc/rpc/dcerpc.h
+++ b/source4/librpc/rpc/dcerpc.h
@@ -305,8 +305,6 @@ NTSTATUS dcerpc_pipe_connect_b(TALLOC_CTX *parent_ctx,
struct cli_credentials *credentials,
struct tevent_context *ev,
struct loadparm_context *lp_ctx);
-const char *dcerpc_errstr(TALLOC_CTX *mem_ctx, uint32_t fault_code);
-NTSTATUS dcerpc_fault_to_nt_status(uint32_t fault_code);
NTSTATUS dcerpc_pipe_auth(TALLOC_CTX *mem_ctx,
struct dcerpc_pipe **p,
@@ -400,124 +398,6 @@ enum dcerpc_transport_t dcerpc_transport_by_endpoint_protocol(int prot);
const char *dcerpc_floor_get_rhs_data(TALLOC_CTX *mem_ctx, struct epm_floor *epm_floor);
-struct tevent_req *dcerpc_read_ncacn_packet_send(TALLOC_CTX *mem_ctx,
- struct tevent_context *ev,
- struct tstream_context *stream);
-NTSTATUS dcerpc_read_ncacn_packet_recv(struct tevent_req *req,
- TALLOC_CTX *mem_ctx,
- struct ncacn_packet **pkt,
- DATA_BLOB *buffer);
-
-struct dcerpc_binding_handle_ops {
- const char *name;
-
- bool (*is_connected)(struct dcerpc_binding_handle *h);
- uint32_t (*set_timeout)(struct dcerpc_binding_handle *h,
- uint32_t timeout);
-
- struct tevent_req *(*raw_call_send)(TALLOC_CTX *mem_ctx,
- struct tevent_context *ev,
- struct dcerpc_binding_handle *h,
- const struct GUID *object,
- uint32_t opnum,
- uint32_t in_flags,
- const uint8_t *in_data,
- size_t in_length);
- NTSTATUS (*raw_call_recv)(struct tevent_req *req,
- TALLOC_CTX *mem_ctx,
- uint8_t **out_data,
- size_t *out_length,
- uint32_t *out_flags);
-
- struct tevent_req *(*disconnect_send)(TALLOC_CTX *mem_ctx,
- struct tevent_context *ev,
- struct dcerpc_binding_handle *h);
- NTSTATUS (*disconnect_recv)(struct tevent_req *req);
-
- /* TODO: remove the following functions */
- bool (*push_bigendian)(struct dcerpc_binding_handle *h);
- bool (*ref_alloc)(struct dcerpc_binding_handle *h);
- bool (*use_ndr64)(struct dcerpc_binding_handle *h);
- void (*do_ndr_print)(struct dcerpc_binding_handle *h,
- int ndr_flags,
- const void *struct_ptr,
- const struct ndr_interface_call *call);
- void (*ndr_push_failed)(struct dcerpc_binding_handle *h,
- NTSTATUS error,
- const void *struct_ptr,
- const struct ndr_interface_call *call);
- void (*ndr_pull_failed)(struct dcerpc_binding_handle *h,
- NTSTATUS error,
- const DATA_BLOB *blob,
- const struct ndr_interface_call *call);
- NTSTATUS (*ndr_validate_in)(struct dcerpc_binding_handle *h,
- TALLOC_CTX *mem_ctx,
- const DATA_BLOB *blob,
- const struct ndr_interface_call *call);
- NTSTATUS (*ndr_validate_out)(struct dcerpc_binding_handle *h,
- struct ndr_pull *pull_in,
- const void *struct_ptr,
- const struct ndr_interface_call *call);
-};
-
-struct dcerpc_binding_handle *_dcerpc_binding_handle_create(TALLOC_CTX *mem_ctx,
- const struct dcerpc_binding_handle_ops *ops,
- const struct GUID *object,
- const struct ndr_interface_table *table,
- void *pstate,
- size_t psize,
- const char *type,
- const char *location);
-#define dcerpc_binding_handle_create(mem_ctx, ops, object, table, \
- state, type, location) \
- _dcerpc_binding_handle_create(mem_ctx, ops, object, table, \
- state, sizeof(type), #type, location)
-
-void *_dcerpc_binding_handle_data(struct dcerpc_binding_handle *h);
-#define dcerpc_binding_handle_data(_h, _type) \
- talloc_get_type_abort(_dcerpc_binding_handle_data(_h), _type)
-
-_DEPRECATED_ void dcerpc_binding_handle_set_sync_ev(struct dcerpc_binding_handle *h,
- struct tevent_context *ev);
-
-bool dcerpc_binding_handle_is_connected(struct dcerpc_binding_handle *h);
-
-uint32_t dcerpc_binding_handle_set_timeout(struct dcerpc_binding_handle *h,
- uint32_t timeout);
-
-struct tevent_req *dcerpc_binding_handle_raw_call_send(TALLOC_CTX *mem_ctx,
- struct tevent_context *ev,
- struct dcerpc_binding_handle *h,
- const struct GUID *object,
- uint32_t opnum,
- uint32_t in_flags,
- const uint8_t *in_data,
- size_t in_length);
-NTSTATUS dcerpc_binding_handle_raw_call_recv(struct tevent_req *req,
- TALLOC_CTX *mem_ctx,
- uint8_t **out_data,
- size_t *out_length,
- uint32_t *out_flags);
-
-struct tevent_req *dcerpc_binding_handle_disconnect_send(TALLOC_CTX *mem_ctx,
- struct tevent_context *ev,
- struct dcerpc_binding_handle *h);
-NTSTATUS dcerpc_binding_handle_disconnect_recv(struct tevent_req *req);
-
-struct tevent_req *dcerpc_binding_handle_call_send(TALLOC_CTX *mem_ctx,
- struct tevent_context *ev,
- struct dcerpc_binding_handle *h,
- const struct GUID *object,
- const struct ndr_interface_table *table,
- uint32_t opnum,
- TALLOC_CTX *r_mem,
- void *r_ptr);
-NTSTATUS dcerpc_binding_handle_call_recv(struct tevent_req *req);
-NTSTATUS dcerpc_binding_handle_call(struct dcerpc_binding_handle *h,
- const struct GUID *object,
- const struct ndr_interface_table *table,
- uint32_t opnum,
- TALLOC_CTX *r_mem,
- void *r_ptr);
+#include "../librpc/rpc/rpc_common.h"
#endif /* __DCERPC_H__ */
diff --git a/source4/librpc/wscript_build b/source4/librpc/wscript_build
index 0d6589ec80..8d1e9a8220 100755
--- a/source4/librpc/wscript_build
+++ b/source4/librpc/wscript_build
@@ -159,7 +159,10 @@ bld.SAMBA_LIBRARY('dcerpc',
deps='samba_socket LIBCLI_RESOLVE LIBCLI_SMB LIBCLI_SMB2 ndr NDR_DCERPC RPC_NDR_EPMAPPER NDR_SCHANNEL RPC_NDR_NETLOGON RPC_NDR_MGMT gensec LIBCLI_AUTH LIBCLI_RAW LP_RESOLVE UTIL_TEVENT rpccommon',
autoproto='rpc/dcerpc_proto.h',
public_deps='credentials tevent talloc',
- public_headers='rpc/dcerpc.h ../../librpc/gen_ndr/mgmt.h ../../librpc/gen_ndr/ndr_mgmt.h ../../librpc/gen_ndr/ndr_mgmt_c.h ../../librpc/gen_ndr/epmapper.h ../../librpc/gen_ndr/ndr_epmapper.h ../../librpc/gen_ndr/ndr_epmapper_c.h',
+ public_headers='''rpc/dcerpc.h ../../librpc/gen_ndr/mgmt.h
+ ../../librpc/gen_ndr/ndr_mgmt.h ../../librpc/gen_ndr/ndr_mgmt_c.h
+ ../../librpc/gen_ndr/epmapper.h ../../librpc/gen_ndr/ndr_epmapper.h
+ ../../librpc/gen_ndr/ndr_epmapper_c.h ../../librpc/rpc/rpc_common.h''',
# It's very important to keep this form of construction
# it force the sambawaf extension to put everything that match the first element
# (*gen_ndr*) into the dir named by the second element (gen_ndr).