smb.h

来自「samba最新软件」· C头文件 代码 · 共 599 行 · 第 1/2 页

H
599
字号
/*    Unix SMB/CIFS implementation.   SMB parameters and setup, plus a whole lot more.      Copyright (C) Andrew Tridgell              1992-2000   Copyright (C) John H Terpstra              1996-2002   Copyright (C) Luke Kenneth Casson Leighton 1996-2000   Copyright (C) Paul Ashton                  1998-2000   Copyright (C) Simo Sorce                   2001-2002   Copyright (C) Martin Pool		      2002      This program is free software; you can redistribute it and/or modify   it under the terms of the GNU General Public License as published by   the Free Software Foundation; either version 3 of the License, or   (at your option) any later version.      This program is distributed in the hope that it will be useful,   but WITHOUT ANY WARRANTY; without even the implied warranty of   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   GNU General Public License for more details.      You should have received a copy of the GNU General Public License   along with this program.  If not, see <http://www.gnu.org/licenses/>.*/#ifndef _SMB_H#define _SMB_H/* deny modes */#define DENY_DOS 0#define DENY_ALL 1#define DENY_WRITE 2#define DENY_READ 3#define DENY_NONE 4#define DENY_FCB 7/* open modes */#define DOS_OPEN_RDONLY 0#define DOS_OPEN_WRONLY 1#define DOS_OPEN_RDWR 2#define DOS_OPEN_FCB 0xF/**********************************//* SMBopen field definitions      */#define OPEN_FLAGS_DENY_MASK  0x70#define OPEN_FLAGS_DENY_DOS   0x00#define OPEN_FLAGS_DENY_ALL   0x10#define OPEN_FLAGS_DENY_WRITE 0x20#define OPEN_FLAGS_DENY_READ  0x30#define OPEN_FLAGS_DENY_NONE  0x40#define OPEN_FLAGS_MODE_MASK  0x0F#define OPEN_FLAGS_OPEN_READ     0#define OPEN_FLAGS_OPEN_WRITE    1#define OPEN_FLAGS_OPEN_RDWR     2#define OPEN_FLAGS_FCB        0xFF/**********************************//* SMBopenX field definitions     *//* OpenX Flags field. */#define OPENX_FLAGS_ADDITIONAL_INFO      0x01#define OPENX_FLAGS_REQUEST_OPLOCK       0x02#define OPENX_FLAGS_REQUEST_BATCH_OPLOCK 0x04#define OPENX_FLAGS_EA_LEN               0x08#define OPENX_FLAGS_EXTENDED_RETURN      0x10/* desired access (open_mode), split info 4 4-bit nibbles */#define OPENX_MODE_ACCESS_MASK   0x000F#define OPENX_MODE_ACCESS_READ   0x0000#define OPENX_MODE_ACCESS_WRITE  0x0001#define OPENX_MODE_ACCESS_RDWR   0x0002#define OPENX_MODE_ACCESS_EXEC   0x0003#define OPENX_MODE_ACCESS_FCB    0x000F#define OPENX_MODE_DENY_SHIFT    4#define OPENX_MODE_DENY_MASK     (0xF        << OPENX_MODE_DENY_SHIFT)#define OPENX_MODE_DENY_DOS      (DENY_DOS   << OPENX_MODE_DENY_SHIFT)#define OPENX_MODE_DENY_ALL      (DENY_ALL   << OPENX_MODE_DENY_SHIFT)#define OPENX_MODE_DENY_WRITE    (DENY_WRITE << OPENX_MODE_DENY_SHIFT)#define OPENX_MODE_DENY_READ     (DENY_READ  << OPENX_MODE_DENY_SHIFT)#define OPENX_MODE_DENY_NONE     (DENY_NONE  << OPENX_MODE_DENY_SHIFT)#define OPENX_MODE_DENY_FCB      (0xF        << OPENX_MODE_DENY_SHIFT)#define OPENX_MODE_LOCALITY_MASK 0x0F00 /* what does this do? */#define OPENX_MODE_NO_CACHE      0x1000#define OPENX_MODE_WRITE_THRU    0x4000/* open function values */#define OPENX_OPEN_FUNC_MASK  0x3#define OPENX_OPEN_FUNC_FAIL  0x0#define OPENX_OPEN_FUNC_OPEN  0x1#define OPENX_OPEN_FUNC_TRUNC 0x2/* The above can be OR'ed with... */#define OPENX_OPEN_FUNC_CREATE 0x10/* openx action in reply */#define OPENX_ACTION_EXISTED    1#define OPENX_ACTION_CREATED    2#define OPENX_ACTION_TRUNCATED  3/**********************************//* SMBntcreateX field definitions *//* ntcreatex flags field. */#define NTCREATEX_FLAGS_REQUEST_OPLOCK       0x02#define NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK 0x04#define NTCREATEX_FLAGS_OPEN_DIRECTORY       0x08 /* TODO: opens parent? we need						     a test suite for this */#define NTCREATEX_FLAGS_EXTENDED             0x10/* the ntcreatex access_mask field    this is split into 4 pieces   AAAABBBBCCCCCCCCDDDDDDDDDDDDDDDD   A -> GENERIC_RIGHT_*   B -> SEC_RIGHT_*   C -> STD_RIGHT_*   D -> SA_RIGHT_*      which set of SA_RIGHT_* bits is applicable depends on the type   of object.*//* ntcreatex share_access field */#define NTCREATEX_SHARE_ACCESS_NONE   0#define NTCREATEX_SHARE_ACCESS_READ   1#define NTCREATEX_SHARE_ACCESS_WRITE  2#define NTCREATEX_SHARE_ACCESS_DELETE 4#define NTCREATEX_SHARE_ACCESS_MASK   7/* ntcreatex open_disposition field */#define NTCREATEX_DISP_SUPERSEDE 0     /* supersede existing file (if it exists) */#define NTCREATEX_DISP_OPEN 1          /* if file exists open it, else fail */#define NTCREATEX_DISP_CREATE 2        /* if file exists fail, else create it */#define NTCREATEX_DISP_OPEN_IF 3       /* if file exists open it, else create it */#define NTCREATEX_DISP_OVERWRITE 4     /* if exists overwrite, else fail */#define NTCREATEX_DISP_OVERWRITE_IF 5  /* if exists overwrite, else create *//* ntcreatex create_options field */#define NTCREATEX_OPTIONS_DIRECTORY                0x0001#define NTCREATEX_OPTIONS_WRITE_THROUGH            0x0002#define NTCREATEX_OPTIONS_SEQUENTIAL_ONLY          0x0004#define NTCREATEX_OPTIONS_SYNC_ALERT	           0x0010#define NTCREATEX_OPTIONS_ASYNC_ALERT	           0x0020#define NTCREATEX_OPTIONS_NON_DIRECTORY_FILE       0x0040#define NTCREATEX_OPTIONS_NO_EA_KNOWLEDGE          0x0200#define NTCREATEX_OPTIONS_EIGHT_DOT_THREE_ONLY     0x0400#define NTCREATEX_OPTIONS_RANDOM_ACCESS            0x0800#define NTCREATEX_OPTIONS_DELETE_ON_CLOSE          0x1000#define NTCREATEX_OPTIONS_OPEN_BY_FILE_ID          0x2000#define NTCREATEX_OPTIONS_BACKUP_INTENT            0x4000#define NTCREATEX_OPTIONS_REPARSE_POINT          0x200000#define NTCREATEX_OPTIONS_UNKNOWN_400000         0x400000/* create options these bits are for private use by backends, they are   not valid on the wire */#define NTCREATEX_OPTIONS_PRIVATE_MASK         0xFF000000#define NTCREATEX_OPTIONS_PRIVATE_DENY_DOS     0x01000000#define NTCREATEX_OPTIONS_PRIVATE_DENY_FCB     0x02000000#define NTCREATEX_OPTIONS_NOT_SUPPORTED_MASK   0x00DFA188 /* ntcreatex impersonation field */#define NTCREATEX_IMPERSONATION_ANONYMOUS      0#define NTCREATEX_IMPERSONATION_IDENTIFICATION 1#define NTCREATEX_IMPERSONATION_IMPERSONATION  2#define NTCREATEX_IMPERSONATION_DELEGATION     3/* ntcreatex security flags bit field */#define NTCREATEX_SECURITY_DYNAMIC             1#define NTCREATEX_SECURITY_ALL                 2/* ntcreatex create_action in reply */#define NTCREATEX_ACTION_EXISTED     1#define NTCREATEX_ACTION_CREATED     2#define NTCREATEX_ACTION_TRUNCATED   3/* the value 5 can also be returned when you try to create a directory with   incorrect parameters - what does it mean? maybe created temporary file? */#define NTCREATEX_ACTION_UNKNOWN 5#define SMB_MAGIC 0x424D53FF /* 0xFF 'S' 'M' 'B' *//* the basic packet size, assuming no words or bytes. Does not include the NBT header */#define MIN_SMB_SIZE 35/* when using NBT encapsulation every packet has a 4 byte header */#define NBT_HDR_SIZE 4/* offsets into message header for common items - NOTE: These have   changed from being offsets from the base of the NBT packet to the base of the SMB packet.   this has reduced all these values by 4*/#define HDR_COM 4#define HDR_RCLS 5#define HDR_REH 6#define HDR_ERR 7#define HDR_FLG 9#define HDR_FLG2 10#define HDR_PIDHIGH 12#define HDR_SS_FIELD 14#define HDR_TID 24#define HDR_PID 26#define HDR_UID 28#define HDR_MID 30#define HDR_WCT 32#define HDR_VWV 33/* types of buffers in core SMB protocol */#define SMB_DATA_BLOCK 0x1#define SMB_ASCII4     0x4/* flag defines. CIFS spec 3.1.1 */#define FLAG_SUPPORT_LOCKREAD       0x01#define FLAG_CLIENT_BUF_AVAIL       0x02#define FLAG_RESERVED               0x04#define FLAG_CASELESS_PATHNAMES     0x08#define FLAG_CANONICAL_PATHNAMES    0x10#define FLAG_REQUEST_OPLOCK         0x20#define FLAG_REQUEST_BATCH_OPLOCK   0x40#define FLAG_REPLY                  0x80/* the complete */#define SMBmkdir      0x00   /* create directory */#define SMBrmdir      0x01   /* delete directory */#define SMBopen       0x02   /* open file */#define SMBcreate     0x03   /* create file */#define SMBclose      0x04   /* close file */#define SMBflush      0x05   /* flush file */#define SMBunlink     0x06   /* delete file */#define SMBmv         0x07   /* rename file */#define SMBgetatr     0x08   /* get file attributes */#define SMBsetatr     0x09   /* set file attributes */#define SMBread       0x0A   /* read from file */#define SMBwrite      0x0B   /* write to file */#define SMBlock       0x0C   /* lock byte range */#define SMBunlock     0x0D   /* unlock byte range */#define SMBctemp      0x0E   /* create temporary file */#define SMBmknew      0x0F   /* make new file */#define SMBchkpth     0x10   /* check directory path */#define SMBexit       0x11   /* process exit */#define SMBlseek      0x12   /* seek */#define SMBtcon       0x70   /* tree connect */#define SMBtconX      0x75   /* tree connect and X*/#define SMBtdis       0x71   /* tree disconnect */#define SMBnegprot    0x72   /* negotiate protocol */#define SMBdskattr    0x80   /* get disk attributes */#define SMBsearch     0x81   /* search directory */#define SMBsplopen    0xC0   /* open print spool file */#define SMBsplwr      0xC1   /* write to print spool file */#define SMBsplclose   0xC2   /* close print spool file */#define SMBsplretq    0xC3   /* return print queue */#define SMBsends      0xD0   /* send single block message */#define SMBsendb      0xD1   /* send broadcast message */#define SMBfwdname    0xD2   /* forward user name */#define SMBcancelf    0xD3   /* cancel forward */#define SMBgetmac     0xD4   /* get machine name */#define SMBsendstrt   0xD5   /* send start of multi-block message */#define SMBsendend    0xD6   /* send end of multi-block message */#define SMBsendtxt    0xD7   /* send text of multi-block message *//* Core+ protocol */#define SMBlockread	  0x13   /* Lock a range and read */#define SMBwriteunlock 0x14 /* write then range then unlock it */#define SMBreadbraw   0x1a  /* read a block of data with no smb header */#define SMBwritebraw  0x1d  /* write a block of data with no smb header */#define SMBwritec     0x20  /* secondary write request */#define SMBwriteclose 0x2c  /* write a file then close it *//* dos extended protocol */#define SMBreadBraw      0x1A   /* read block raw */#define SMBreadBmpx      0x1B   /* read block multiplexed */#define SMBreadBs        0x1C   /* read block (secondary response) */#define SMBwriteBraw     0x1D   /* write block raw */#define SMBwriteBmpx     0x1E   /* write block multiplexed */#define SMBwriteBs       0x1F   /* write block (secondary request) */#define SMBwriteC        0x20   /* write complete response */#define SMBsetattrE      0x22   /* set file attributes expanded */#define SMBgetattrE      0x23   /* get file attributes expanded */#define SMBlockingX      0x24   /* lock/unlock byte ranges and X */#define SMBtrans         0x25   /* transaction - name, bytes in/out */#define SMBtranss        0x26   /* transaction (secondary request/response) */#define SMBioctl         0x27   /* IOCTL */#define SMBioctls        0x28   /* IOCTL  (secondary request/response) */#define SMBcopy          0x29   /* copy */#define SMBmove          0x2A   /* move */#define SMBecho          0x2B   /* echo */#define SMBopenX         0x2D   /* open and X */#define SMBreadX         0x2E   /* read and X */#define SMBwriteX        0x2F   /* write and X */#define SMBsesssetupX    0x73   /* Session Set Up & X (including User Logon) */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?