summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2011-10-20 09:42:10 +0200
committerStefan Metzmacher <metze@samba.org>2011-10-21 08:42:59 +0200
commite03b312b12785dc226c8f63e5d728e158fad38fd (patch)
tree71b31fc2ed1e5712cd356c556fe860f16d6873e9
parent32938ce60dff821964dbc199c47abe2e7a8fa1ea (diff)
downloadsamba-e03b312b12785dc226c8f63e5d728e158fad38fd.tar.gz
samba-e03b312b12785dc226c8f63e5d728e158fad38fd.tar.bz2
samba-e03b312b12785dc226c8f63e5d728e158fad38fd.zip
libcli/smb: add smb_setlen_[nbt|tcp] macros
metze
-rw-r--r--libcli/smb/smb_constants.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/libcli/smb/smb_constants.h b/libcli/smb/smb_constants.h
index 886e35884f..3bedf2593b 100644
--- a/libcli/smb/smb_constants.h
+++ b/libcli/smb/smb_constants.h
@@ -61,9 +61,17 @@
#define smb_len_nbt(buf) (RIVAL(buf, 0) & 0x1FFFF)
#define _smb_setlen_nbt(buf,len) RSIVAL(buf, 0, (len) & 0x1FFFF)
+#define smb_setlen_nbt(buf, len) do { \
+ _smb_setlen_nbt(buf, len); \
+ SIVAL(buf, 4, SMB_MAGIC); \
+} while (0)
#define smb_len_tcp(buf) (RIVAL(buf, 0) & 0xFFFFFF)
#define _smb_setlen_tcp(buf,len) RSIVAL(buf, 0, (len) & 0xFFFFFF)
+#define smb_setlen_tcp(buf, len) do { \
+ _smb_setlen_tcp(buf, len); \
+ SIVAL(buf, 4, SMB_MAGIC); \
+} while (0)
/* protocol types. It assumes that higher protocols include lower protocols
as subsets. */