libcli/smb: add smb_[set]len_[nbt|tcp]() macros
authorStefan Metzmacher <metze@samba.org>
Wed, 19 Oct 2011 11:48:09 +0000 (13:48 +0200)
committerStefan Metzmacher <metze@samba.org>
Wed, 19 Oct 2011 13:44:29 +0000 (15:44 +0200)
metze

libcli/smb/smb_constants.h

index b480001f697bcae01b131f223048e1f5e20175cf..91330ddbae58693f579ad6396dc10329c3f4e81f 100644 (file)
 #define NBSSretarget    0x84   /* retarget session response */
 #define NBSSkeepalive   0x85   /* keepalive */
 
+#define smb_len_nbt(buf) (RIVAL(buf, 0) & 0x1FFFF)
+#define _smb_setlen_nbt(buf,len) RSIVAL(buf, 0, (len) & 0x1FFFF)
+
+#define smb_len_tcp(buf) (RIVAL(buf, 0) & 0xFFFFFF)
+#define _smb_setlen_tcp(buf,len) RSIVAL(buf, 0, (len) & 0xFFFFFF)
+
 /* protocol types. It assumes that higher protocols include lower protocols
    as subsets. */
 enum protocol_types {