smb.h 5.4 KB

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