From 7ee54cd9c45c30d1a384ffcdeea45b2a7898b117 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sun, 5 Aug 2012 14:53:15 +0200 Subject: 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 --- source3/smbd/globals.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'source3/smbd') 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]; -- cgit