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