3 /* @(#) Header: /tcpdump/master/tcpdump/smb.h,v 1.9 2004/12/28 22:29:44 guy Exp (LBL) */
5 * Copyright (C) Andrew Tridgell 1995-1999
7 * This software may be distributed either under the terms of the
8 * BSD-style license that accompanies tcpdump or the GNU GPL version 2
12 #define SMBMIN(a,b) ((a)<(b)?(a):(b))
15 #define SMBmkdir 0x00 /* create directory */
16 #define SMBrmdir 0x01 /* delete directory */
17 #define SMBopen 0x02 /* open file */
18 #define SMBcreate 0x03 /* create file */
19 #define SMBclose 0x04 /* close file */
20 #define SMBflush 0x05 /* flush file */
21 #define SMBunlink 0x06 /* delete file */
22 #define SMBmv 0x07 /* rename file */
23 #define SMBgetatr 0x08 /* get file attributes */
24 #define SMBsetatr 0x09 /* set file attributes */
25 #define SMBread 0x0A /* read from file */
26 #define SMBwrite 0x0B /* write to file */
27 #define SMBlock 0x0C /* lock byte range */
28 #define SMBunlock 0x0D /* unlock byte range */
29 #define SMBctemp 0x0E /* create temporary file */
30 #define SMBmknew 0x0F /* make new file */
31 #define SMBchkpth 0x10 /* check directory path */
32 #define SMBexit 0x11 /* process exit */
33 #define SMBlseek 0x12 /* seek */
34 #define SMBtcon 0x70 /* tree connect */
35 #define SMBtconX 0x75 /* tree connect and X*/
36 #define SMBtdis 0x71 /* tree disconnect */
37 #define SMBnegprot 0x72 /* negotiate protocol */
38 #define SMBdskattr 0x80 /* get disk attributes */
39 #define SMBsearch 0x81 /* search directory */
40 #define SMBsplopen 0xC0 /* open print spool file */
41 #define SMBsplwr 0xC1 /* write to print spool file */
42 #define SMBsplclose 0xC2 /* close print spool file */
43 #define SMBsplretq 0xC3 /* return print queue */
44 #define SMBsends 0xD0 /* send single block message */
45 #define SMBsendb 0xD1 /* send broadcast message */
46 #define SMBfwdname 0xD2 /* forward user name */
47 #define SMBcancelf 0xD3 /* cancel forward */
48 #define SMBgetmac 0xD4 /* get machine name */
49 #define SMBsendstrt 0xD5 /* send start of multi-block message */
50 #define SMBsendend 0xD6 /* send end of multi-block message */
51 #define SMBsendtxt 0xD7 /* send text of multi-block message */
54 #define SMBlockread 0x13 /* Lock a range and read */
55 #define SMBwriteunlock 0x14 /* Unlock a range then write */
56 #define SMBreadbraw 0x1a /* read a block of data with no smb header */
57 #define SMBwritebraw 0x1d /* write a block of data with no smb header */
58 #define SMBwritec 0x20 /* secondary write request */
59 #define SMBwriteclose 0x2c /* write a file then close it */
61 /* dos extended protocol */
62 #define SMBreadBraw 0x1A /* read block raw */
63 #define SMBreadBmpx 0x1B /* read block multiplexed */
64 #define SMBreadBs 0x1C /* read block (secondary response) */
65 #define SMBwriteBraw 0x1D /* write block raw */
66 #define SMBwriteBmpx 0x1E /* write block multiplexed */
67 #define SMBwriteBs 0x1F /* write block (secondary request) */
68 #define SMBwriteC 0x20 /* write complete response */
69 #define SMBsetattrE 0x22 /* set file attributes expanded */
70 #define SMBgetattrE 0x23 /* get file attributes expanded */
71 #define SMBlockingX 0x24 /* lock/unlock byte ranges and X */
72 #define SMBtrans 0x25 /* transaction - name, bytes in/out */
73 #define SMBtranss 0x26 /* transaction (secondary request/response) */
74 #define SMBioctl 0x27 /* IOCTL */
75 #define SMBioctls 0x28 /* IOCTL (secondary request/response) */
76 #define SMBcopy 0x29 /* copy */
77 #define SMBmove 0x2A /* move */
78 #define SMBecho 0x2B /* echo */
79 #define SMBopenX 0x2D /* open and X */
80 #define SMBreadX 0x2E /* read and X */
81 #define SMBwriteX 0x2F /* write and X */
82 #define SMBsesssetupX 0x73 /* Session Set Up & X (including User Logon) */
83 #define SMBffirst 0x82 /* find first */
84 #define SMBfunique 0x83 /* find unique */
85 #define SMBfclose 0x84 /* find close */
86 #define SMBinvalid 0xFE /* invalid command */
88 /* Extended 2.0 protocol */
89 #define SMBtrans2 0x32 /* TRANS2 protocol set */
90 #define SMBtranss2 0x33 /* TRANS2 protocol set, secondary command */
91 #define SMBfindclose 0x34 /* Terminate a TRANSACT2_FINDFIRST */
92 #define SMBfindnclose 0x35 /* Terminate a TRANSACT2_FINDNOTIFYFIRST */
93 #define SMBulogoffX 0x74 /* user logoff */
95 /* NT SMB extensions. */
96 #define SMBnttrans 0xA0 /* NT transact */
97 #define SMBnttranss 0xA1 /* NT transact secondary */
98 #define SMBntcreateX 0xA2 /* NT create and X */
99 #define SMBntcancel 0xA4 /* NT cancel */
101 /* pathworks special */
102 #define pSETDIR '\377'
105 /* these are the TRANS2 sub commands */
106 #define TRANSACT2_OPEN 0
107 #define TRANSACT2_FINDFIRST 1
108 #define TRANSACT2_FINDNEXT 2
109 #define TRANSACT2_QFSINFO 3
110 #define TRANSACT2_SETFSINFO 4
111 #define TRANSACT2_QPATHINFO 5
112 #define TRANSACT2_SETPATHINFO 6
113 #define TRANSACT2_QFILEINFO 7
114 #define TRANSACT2_SETFILEINFO 8
115 #define TRANSACT2_FSCTL 9
116 #define TRANSACT2_IOCTL 10
117 #define TRANSACT2_FINDNOTIFYFIRST 11
118 #define TRANSACT2_FINDNOTIFYNEXT 12
119 #define TRANSACT2_MKDIR 13
121 #define PTR_DIFF(p1, p2) ((size_t)(((char *)(p1)) - (char *)(p2)))
124 const u_char
*smb_fdata(const u_char
*, const char *, const u_char
*, int);