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