summaryrefslogtreecommitdiff
path: root/librpc
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2011-02-24 11:55:45 +1100
committerAndrew Tridgell <tridge@samba.org>2011-02-24 02:42:37 +0100
commit5ec284d15289c5716114bff99a19890abbd45fb3 (patch)
treeac6df871aae3cda79b5f979817f985944667edbb /librpc
parent52fe20c3103bbdec72f95344f07dd98b0fa915ce (diff)
downloadsamba-5ec284d15289c5716114bff99a19890abbd45fb3.tar.gz
samba-5ec284d15289c5716114bff99a19890abbd45fb3.tar.bz2
samba-5ec284d15289c5716114bff99a19890abbd45fb3.zip
build: moved librpc/rpc/*.c into a rpccommon library
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org> Autobuild-User: Andrew Tridgell <tridge@samba.org> Autobuild-Date: Thu Feb 24 02:42:37 CET 2011 on sn-devel-104
Diffstat (limited to 'librpc')
-rw-r--r--librpc/rpc/binding.c2
-rw-r--r--librpc/rpc/binding_handle.c1
-rw-r--r--librpc/rpc/dcerpc_error.c1
-rw-r--r--librpc/rpc/dcerpc_util.c1
-rw-r--r--librpc/rpc/rpc_common.h101
-rw-r--r--librpc/wscript_build5
6 files changed, 111 insertions, 0 deletions
diff --git a/librpc/rpc/binding.c b/librpc/rpc/binding.c
index b7c3a40a0d..2a0295b1e8 100644
--- a/librpc/rpc/binding.c
+++ b/librpc/rpc/binding.c
@@ -27,6 +27,8 @@
#include "librpc/gen_ndr/ndr_epmapper.h"
#include "librpc/gen_ndr/ndr_misc.h"
#include "librpc/rpc/dcerpc.h"
+#include "rpc_common.h"
+
#undef strcasecmp
#undef strncasecmp
diff --git a/librpc/rpc/binding_handle.c b/librpc/rpc/binding_handle.c
index 93c0fd4f00..9ad7a9bde8 100644
--- a/librpc/rpc/binding_handle.c
+++ b/librpc/rpc/binding_handle.c
@@ -23,6 +23,7 @@
#include <tevent.h>
#include "../lib/util/tevent_ntstatus.h"
#include "librpc/rpc/dcerpc.h"
+#include "rpc_common.h"
struct dcerpc_binding_handle {
void *private_data;
diff --git a/librpc/rpc/dcerpc_error.c b/librpc/rpc/dcerpc_error.c
index 17095e5057..7c98386664 100644
--- a/librpc/rpc/dcerpc_error.c
+++ b/librpc/rpc/dcerpc_error.c
@@ -21,6 +21,7 @@
#include "includes.h"
#include "librpc/rpc/dcerpc.h"
+#include "rpc_common.h"
struct dcerpc_fault_table {
const char *errstr;
diff --git a/librpc/rpc/dcerpc_util.c b/librpc/rpc/dcerpc_util.c
index 1db43df34a..a405ca8966 100644
--- a/librpc/rpc/dcerpc_util.c
+++ b/librpc/rpc/dcerpc_util.c
@@ -26,6 +26,7 @@
#include "lib/util/tevent_ntstatus.h"
#include "librpc/rpc/dcerpc.h"
#include "librpc/gen_ndr/ndr_dcerpc.h"
+#include "rpc_common.h"
/* we need to be able to get/set the fragment length without doing a full
decode */
diff --git a/librpc/rpc/rpc_common.h b/librpc/rpc/rpc_common.h
new file mode 100644
index 0000000000..3f5216bdec
--- /dev/null
+++ b/librpc/rpc/rpc_common.h
@@ -0,0 +1,101 @@
+#ifndef __DEFAULT_LIBRPC_RPCCOMMON_H__
+#define __DEFAULT_LIBRPC_RPCCOMMON_H__
+
+/* The following definitions come from ../librpc/rpc/dcerpc_error.c */
+
+
+/* The following definitions come from ../librpc/rpc/binding.c */
+
+const char *epm_floor_string(TALLOC_CTX *mem_ctx, struct epm_floor *epm_floor);
+const char *dcerpc_floor_get_rhs_data(TALLOC_CTX *mem_ctx, struct epm_floor *epm_floor);
+enum dcerpc_transport_t dcerpc_transport_by_endpoint_protocol(int prot);
+
+/* 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);
+uint8_t dcerpc_get_endian_flag(DATA_BLOB *blob);
+
+/**
+* @brief Pull a dcerpc_auth structure, taking account of any auth
+* padding in the blob. For request/response packets we pass
+* the whole data blob, so auth_data_only must be set to false
+* as the blob contains data+pad+auth and no just pad+auth.
+*
+* @param pkt - The ncacn_packet strcuture
+* @param mem_ctx - The mem_ctx used to allocate dcerpc_auth elements
+* @param pkt_trailer - The packet trailer data, usually the trailing
+* auth_info blob, but in the request/response case
+* this is the stub_and_verifier blob.
+* @param auth - A preallocated dcerpc_auth *empty* structure
+* @param auth_length - The length of the auth trail, sum of auth header
+* lenght and pkt->auth_length
+* @param auth_data_only - Whether the pkt_trailer includes only the auth_blob
+* (+ padding) or also other data.
+*
+* @return - A NTSTATUS error code.
+*/
+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);
+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);
+
+/* The following definitions come from ../librpc/rpc/binding_handle.c */
+
+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);
+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);
+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);
+#endif /* __DEFAULT_LIBRPC_RPCCOMMON_H__ */
diff --git a/librpc/wscript_build b/librpc/wscript_build
index 1c41af377f..354dec14b7 100644
--- a/librpc/wscript_build
+++ b/librpc/wscript_build
@@ -565,3 +565,8 @@ bld.SAMBA_LIBRARY('ndr',
depends_on='PIDL_MISC',
vnum='0.0.1'
)
+
+bld.SAMBA_LIBRARY('rpccommon',
+ source='rpc/dcerpc_error.c rpc/binding.c rpc/dcerpc_util.c rpc/binding_handle.c',
+ deps='ndr tevent NDR_DCERPC LIBTSOCKET',
+ private_library=True)