From 349977e1a071137ca33b831660e8c65c2e580b5f Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 15 Sep 2011 12:46:59 +0200 Subject: s3:smb2cli: replace smb2cli_base.c code with the more generic smbXcli_base.c code metze --- source3/libsmb/smb2cli_base.h | 63 ++++++++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 28 deletions(-) (limited to 'source3/libsmb/smb2cli_base.h') diff --git a/source3/libsmb/smb2cli_base.h b/source3/libsmb/smb2cli_base.h index 105f8ebe1c..efef350f5d 100644 --- a/source3/libsmb/smb2cli_base.h +++ b/source3/libsmb/smb2cli_base.h @@ -20,45 +20,52 @@ #ifndef __SMB2CLI_BASE_H__ #define __SMB2CLI_BASE_H__ -struct tevent_req *smb2cli_req_create(TALLOC_CTX *mem_ctx, - struct tevent_context *ev, - struct cli_state *cli, - uint16_t cmd, - uint32_t additional_flags, - uint32_t clear_flags, - unsigned int timeout, - uint32_t pid, - uint32_t tid, - uint64_t uid, - const uint8_t *fixed, - uint16_t fixed_len, - const uint8_t *dyn, - uint32_t dyn_len); -NTSTATUS smb2cli_req_compound_submit(struct tevent_req **reqs, - int num_reqs); +#include "../libcli/smb/smbXcli_base.h" -struct smb2cli_req_expected_response { - NTSTATUS status; - uint16_t body_size; -}; - -struct tevent_req *smb2cli_req_send(TALLOC_CTX *mem_ctx, +static inline struct tevent_req *cli_state_smb2cli_req_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct cli_state *cli, uint16_t cmd, uint32_t additional_flags, uint32_t clear_flags, - unsigned int timeout, + uint32_t timeout_msec, uint32_t pid, uint32_t tid, uint64_t uid, const uint8_t *fixed, uint16_t fixed_len, const uint8_t *dyn, - uint32_t dyn_len); -NTSTATUS smb2cli_req_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx, - struct iovec **piov, - const struct smb2cli_req_expected_response *expected, - size_t num_expected); + uint32_t dyn_len) +{ + if (cli->smb2.conn == NULL) { + cli->smb2.conn = smbXcli_conn_create(cli, + cli->conn.fd, + cli->conn.remote_name, + SMB_SIGNING_OFF, + 0); /* smb1_capabilities */ + if (cli->smb2.conn == NULL) { + return NULL; + } + } + + return smb2cli_req_send(mem_ctx, ev, + cli->smb2.conn, cmd, + additional_flags, clear_flags, + timeout_msec, + pid, tid, uid, + fixed, fixed_len, + dyn, dyn_len); +} + +#define smb2cli_req_send(mem_ctx, ev, cli, cmd, \ + additional_flags, clear_flags, \ + timeout_msec, \ + pid, tid, uid, \ + fixed, fixed_len, dyn, dyn_len) \ + cli_state_smb2cli_req_send(mem_ctx, ev, cli, cmd, \ + additional_flags, clear_flags, \ + timeout_msec, \ + pid, tid, uid, \ + fixed, fixed_len, dyn, dyn_len) #endif -- cgit