#include "lib/util/attr.h"
struct dcerpc_binding_handle;
+struct dcerpc_pipe_handle;
+struct dcerpc_pipe_handle_connection;
struct GUID;
struct ndr_interface_table;
struct ndr_interface_call;
#define DCERPC_PACKET (1<<26)
+#define DCERPC_SMB1 (1<<27)
+
/* The following definitions come from ../librpc/rpc/dcerpc_error.c */
const char *dcerpc_errstr(TALLOC_CTX *mem_ctx, uint32_t fault_code);
NTSTATUS dcerpc_binding_set_string_option(struct dcerpc_binding *b,
const char *name,
const char *value);
+void *_dcerpc_binding_get_pointer_option(const struct dcerpc_binding *b,
+ const char *name,
+ const char *type);
+#define dcerpc_binding_get_pointer_option(b, name, type) \
+ talloc_get_type(_dcerpc_binding_get_pointer_option(b, name, #type), type)
+NTSTATUS _dcerpc_binding_set_pointer_option(struct dcerpc_binding *b,
+ const char *name,
+ const char *type,
+ const void *vp);
+#define dcerpc_binding_set_pointer_option(b, name, type, vp) \
+ _dcerpc_binding_set_pointer_option(b, name, #type, vp)
uint32_t dcerpc_binding_get_flags(const struct dcerpc_binding *b);
NTSTATUS dcerpc_binding_set_flags(struct dcerpc_binding *b,
uint32_t additional,
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);
+uint16_t dcerpc_get_auth_length(const DATA_BLOB *blob);
uint8_t dcerpc_get_endian_flag(DATA_BLOB *blob);
+uint8_t dcerpc_get_auth_type(const DATA_BLOB *blob);
+uint8_t dcerpc_get_auth_level(const DATA_BLOB *blob);
+uint32_t dcerpc_get_auth_context_id(const DATA_BLOB *blob);
const char *dcerpc_default_transport_endpoint(TALLOC_CTX *mem_ctx,
enum dcerpc_transport_t transport,
const struct ndr_interface_table *table);
uint8_t **out_data,
size_t *out_length,
uint32_t *out_flags);
+ struct tevent_req *(*raw_call_in_send)(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct tevent_req *raw_call_req,
+ uint32_t in_flags,
+ const uint8_t *in_data,
+ size_t in_length);
+ NTSTATUS (*raw_call_in_recv)(struct tevent_req *req);
struct tevent_req *(*disconnect_send)(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
uint8_t **out_data,
size_t *out_length,
uint32_t *out_flags);
+struct tevent_req *dcerpc_binding_handle_raw_call_in_send(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct tevent_req *raw_call_req,
+ uint32_t in_flags,
+ const uint8_t *in_data,
+ size_t in_length);
+NTSTATUS dcerpc_binding_handle_raw_call_in_recv(struct tevent_req *req);
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 dcerpc_binding_handle_call_params {
+ TALLOC_CTX *r_mem;
+ void *r_ptr;
+ struct {
+ uint32_t num_pipes;
+ struct dcerpc_pipe_handle_connection **pipes;
+ } in, out;
+};
+
+struct tevent_req *dcerpc_binding_handle_call_params_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,
+ struct dcerpc_binding_handle_call_params *params);
+NTSTATUS dcerpc_binding_handle_call_params_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,
(DCERPC_AUTH_PAD_ALIGNMENT - (stub_length) % DCERPC_AUTH_PAD_ALIGNMENT):\
0)
+struct dcerpc_pipe_handle_connection *dcerpc_pipe_handle_connection_create(
+ TALLOC_CTX *mem_ctx,
+ const char *chunk_struct_name,
+ size_t chunk_struct_size);
+bool _dcerpc_pipe_handle_connection_connect(
+ struct dcerpc_pipe_handle_connection *pc,
+ const char *chunk_struct_name,
+ size_t chunk_struct_size,
+ struct dcerpc_pipe_handle *p,
+ bool push);
+#define dcerpc_pipe_handle_connection_push_connect(pc, csn, css, p) \
+ _dcerpc_pipe_handle_connection_connect(pc, csn, css, p, true)
+#define dcerpc_pipe_handle_connection_pull_connect(pc, csn, css, p) \
+ _dcerpc_pipe_handle_connection_connect(pc, csn, css, p, false)
+void dcerpc_pipe_handle_connection_disconnect(
+ struct dcerpc_pipe_handle_connection *pc);
+
+struct dcerpc_pipe_handle_ops {
+ const char *name;
+
+ struct tevent_req *(*chunk_push_send)(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct dcerpc_pipe_handle *p,
+ const void *chunk_ptr);
+ NTSTATUS (*chunk_push_recv)(struct tevent_req *req);
+
+ struct tevent_req *(*chunk_pull_send)(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct dcerpc_pipe_handle *p,
+ void *chunk_mem,
+ void *chunk_ptr);
+ NTSTATUS (*chunk_pull_recv)(struct tevent_req *req);
+};
+
+struct dcerpc_pipe_handle *_dcerpc_pipe_handle_create(
+ TALLOC_CTX *mem_ctx,
+ const struct dcerpc_pipe_handle_ops *ops,
+ void *pstate,
+ size_t psize,
+ const char *type,
+ const char *location);
+#define dcerpc_pipe_handle_create(mem_ctx, ops, \
+ state, type) \
+ _dcerpc_pipe_handle_create(mem_ctx, ops, \
+ state, sizeof(type), #type, __location__)
+
+void *_dcerpc_pipe_handle_data(struct dcerpc_pipe_handle *p);
+#define dcerpc_pipe_handle_data(_p, _type) \
+ talloc_get_type_abort(_dcerpc_pipe_handle_data(_p), _type)
+
+struct tevent_req *dcerpc_pipe_handle_push_send(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct dcerpc_pipe_handle_connection *pc,
+ const void *chunk_ptr);
+NTSTATUS dcerpc_pipe_handle_push_recv(struct tevent_req *req);
+
+struct tevent_req *dcerpc_pipe_handle_pull_send(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct dcerpc_pipe_handle_connection *pc,
+ void *chunk_mem,
+ void *chunk_ptr);
+NTSTATUS dcerpc_pipe_handle_pull_recv(struct tevent_req *req);
+
#endif /* __DEFAULT_LIBRPC_RPCCOMMON_H__ */