From: Stefan Metzmacher Date: Sun, 5 Aug 2012 12:53:15 +0000 (+0200) Subject: s3:smbd: add helper macros to access smb2req->{in,out}.vector[] X-Git-Tag: ldb-1.1.10~117 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7ee54cd9c45c30d1a384ffcdeea45b2a7898b117;p=thirdparty%2Fsamba.git 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 --- diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h index 94098f02818..cf9d01b9f70 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];