summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2012-08-05 14:53:15 +0200
committerStefan Metzmacher <metze@samba.org>2012-08-05 20:55:34 +0200
commit7ee54cd9c45c30d1a384ffcdeea45b2a7898b117 (patch)
treefe457351e105fce9db9e1b4342c567d2639d8628
parent7327310754045e8a2029098ce76a0e677c590460 (diff)
downloadsamba-7ee54cd9c45c30d1a384ffcdeea45b2a7898b117.tar.gz
samba-7ee54cd9c45c30d1a384ffcdeea45b2a7898b117.tar.bz2
samba-7ee54cd9c45c30d1a384ffcdeea45b2a7898b117.zip
s3:smbd: add helper macros to access smb2req->{in,out}.vector[]
For SMB3 encryption we need to change the vector layout and we better hide this behind some central macros. metze
-rw-r--r--source3/smbd/globals.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h
index 94098f0281..cf9d01b9f7 100644
--- a/source3/smbd/globals.h
+++ b/source3/smbd/globals.h
@@ -474,6 +474,24 @@ struct smbd_smb2_request {
*/
struct tevent_req *subreq;
+#define SMBD_SMB2_IN_HDR_IOV(req) (&req->in.vector[req->current_idx+0])
+#define SMBD_SMB2_IN_HDR_PTR(req) (uint8_t *)(SMBD_SMB2_IN_HDR_IOV(req)->iov_base)
+#define SMBD_SMB2_IN_BODY_IOV(req) (&req->in.vector[req->current_idx+1])
+#define SMBD_SMB2_IN_BODY_PTR(req) (uint8_t *)(SMBD_SMB2_IN_BODY_IOV(req)->iov_base)
+#define SMBD_SMB2_IN_BODY_LEN(req) (SMBD_SMB2_IN_BODY_IOV(req)->iov_len)
+#define SMBD_SMB2_IN_DYN_IOV(req) (&req->in.vector[req->current_idx+2])
+#define SMBD_SMB2_IN_DYN_PTR(req) (uint8_t *)(SMBD_SMB2_IN_DYN_IOV(req)->iov_base)
+#define SMBD_SMB2_IN_DYN_LEN(req) (SMBD_SMB2_IN_DYN_IOV(req)->iov_len)
+
+#define SMBD_SMB2_OUT_HDR_IOV(req) (&req->out.vector[req->current_idx+0])
+#define SMBD_SMB2_OUT_HDR_PTR(req) (uint8_t *)(SMBD_SMB2_OUT_HDR_IOV(req)->iov_base)
+#define SMBD_SMB2_OUT_BODY_IOV(req) (&req->out.vector[req->current_idx+1])
+#define SMBD_SMB2_OUT_BODY_PTR(req) (uint8_t *)(SMBD_SMB2_OUT_BODY_IOV(req)->iov_base)
+#define SMBD_SMB2_OUT_BODY_LEN(req) (SMBD_SMB2_OUT_BODY_IOV(req)->iov_len)
+#define SMBD_SMB2_OUT_DYN_IOV(req) (&req->out.vector[req->current_idx+2])
+#define SMBD_SMB2_OUT_DYN_PTR(req) (uint8_t *)(SMBD_SMB2_OUT_DYN_IOV(req)->iov_base)
+#define SMBD_SMB2_OUT_DYN_LEN(req) (SMBD_SMB2_OUT_DYN_IOV(req)->iov_len)
+
struct {
/* the NBT header is not allocated */
uint8_t nbt_hdr[4];