⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 smb.h

📁 samba-3.0.22.tar.gz 编译smb服务器的源码
💻 H
📖 第 1 页 / 共 4 页
字号:
/*    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 2 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, write to the Free Software   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.*/#ifndef _SMB_H#define _SMB_H/* logged when starting the various Samba daemons */#define COPYRIGHT_STARTUP_MESSAGE	"Copyright Andrew Tridgell and the Samba Team 1992-2006"#if defined(LARGE_SMB_OFF_T)#define BUFFER_SIZE (128*1024)#else /* no large readwrite possible */#define BUFFER_SIZE (0xFFFF)#endif#define SAFETY_MARGIN 1024#define LARGE_WRITEX_HDR_SIZE 65#define NMB_PORT 137#define DGRAM_PORT 138#define SMB_PORT1 445#define SMB_PORT2 139#define SMB_PORTS "445 139"#define Undefined (-1)#define False (0)#define True (1)#define Auto (2)#define Required (3)#ifndef _BOOLtypedef int BOOL;#define _BOOL       /* So we don't typedef BOOL again in vfs.h */#endif#define SIZEOFWORD 2#ifndef DEF_CREATE_MASK#define DEF_CREATE_MASK (0755)#endif/* string manipulation flags - see clistr.c and srvstr.c */#define STR_TERMINATE 1#define STR_UPPER 2#define STR_ASCII 4#define STR_UNICODE 8#define STR_NOALIGN 16#define STR_TERMINATE_ASCII 128/* how long to wait for secondary SMB packets (milli-seconds) */#define SMB_SECONDARY_WAIT (60*1000)/* Debugging stuff */#include "debug.h"/* this defines the error codes that receive_smb can put in smb_read_error */#define READ_TIMEOUT 1#define READ_EOF 2#define READ_ERROR 3#define WRITE_ERROR 4 /* This error code can go into the client smb_rw_error. */#define READ_BAD_SIG 5#define DO_NOT_DO_TDIS 6 /* cli_close_connection() check for this when smbfs wants to keep tree connected */#define DIR_STRUCT_SIZE 43/* these define the attribute byte as seen by DOS */#define aRONLY (1L<<0)		/* 0x01 */#define aHIDDEN (1L<<1)		/* 0x02 */#define aSYSTEM (1L<<2)		/* 0x04 */#define aVOLID (1L<<3)		/* 0x08 */#define aDIR (1L<<4)		/* 0x10 */#define aARCH (1L<<5)		/* 0x20 *//* 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_EXEC 3#define DOS_OPEN_FCB 0xF/* define shifts and masks for share and open modes. */#define OPENX_MODE_MASK 0xF#define DENY_MODE_SHIFT 4#define DENY_MODE_MASK 0x7#define GET_OPENX_MODE(x) ((x) & OPENX_MODE_MASK)#define SET_OPENX_MODE(x) ((x) & OPENX_MODE_MASK)#define GET_DENY_MODE(x) (((x)>>DENY_MODE_SHIFT) & DENY_MODE_MASK)#define SET_DENY_MODE(x) (((x) & DENY_MODE_MASK) <<DENY_MODE_SHIFT)/* Sync on open file (not sure if used anymore... ?) */#define FILE_SYNC_OPENMODE (1<<14)#define GET_FILE_SYNC_OPENMODE(x) (((x) & FILE_SYNC_OPENMODE) ? True : False)/* open disposition values */#define OPENX_FILE_EXISTS_FAIL 0#define OPENX_FILE_EXISTS_OPEN 1#define OPENX_FILE_EXISTS_TRUNCATE 2/* mask for open disposition. */#define OPENX_FILE_OPEN_MASK 0x3#define GET_FILE_OPENX_DISPOSITION(x) ((x) & FILE_OPEN_MASK)#define SET_FILE_OPENX_DISPOSITION(x) ((x) & FILE_OPEN_MASK)/* The above can be OR'ed with... */#define OPENX_FILE_CREATE_IF_NOT_EXIST 0x10#define OPENX_FILE_FAIL_IF_NOT_EXIST 0/* share types */#define STYPE_DISKTREE  0	/* Disk drive */#define STYPE_PRINTQ    1	/* Spooler queue */#define STYPE_DEVICE    2	/* Serial device */#define STYPE_IPC       3	/* Interprocess communication (IPC) */#define STYPE_HIDDEN    0x80000000 /* share is a hidden one (ends with $) */#include "doserr.h"typedef union unid_t {	uid_t uid;	gid_t gid;} unid_t;/* * SMB UCS2 (16-bit unicode) internal type. * smb_ucs2_t is *always* in little endian format. */typedef uint16 smb_ucs2_t;/* ucs2 string types. */typedef smb_ucs2_t wpstring[PSTRING_LEN];typedef smb_ucs2_t wfstring[FSTRING_LEN];#ifdef WORDS_BIGENDIAN#define UCS2_SHIFT 8#else#define UCS2_SHIFT 0#endif/* turn a 7 bit character into a ucs2 character */#define UCS2_CHAR(c) ((c) << UCS2_SHIFT)/* return an ascii version of a ucs2 character */#define UCS2_TO_CHAR(c) (((c) >> UCS2_SHIFT) & 0xff)/* Copy into a smb_ucs2_t from a possibly unaligned buffer. Return the copied smb_ucs2_t */#define COPY_UCS2_CHAR(dest,src) (((unsigned char *)(dest))[0] = ((unsigned char *)(src))[0],\				((unsigned char *)(dest))[1] = ((unsigned char *)(src))[1], (dest))/* pipe string names */#define PIPE_LANMAN   "\\PIPE\\LANMAN"#define PIPE_SRVSVC   "\\PIPE\\srvsvc"#define PIPE_SAMR     "\\PIPE\\samr"#define PIPE_WINREG   "\\PIPE\\winreg"#define PIPE_WKSSVC   "\\PIPE\\wkssvc"#define PIPE_NETLOGON "\\PIPE\\NETLOGON"#define PIPE_NTLSA    "\\PIPE\\ntlsa"#define PIPE_NTSVCS   "\\PIPE\\ntsvcs"#define PIPE_LSASS    "\\PIPE\\lsass"#define PIPE_LSARPC   "\\PIPE\\lsarpc"#define PIPE_SPOOLSS  "\\PIPE\\spoolss"#define PIPE_NETDFS   "\\PIPE\\netdfs"#define PIPE_ECHO     "\\PIPE\\rpcecho"#define PIPE_SHUTDOWN "\\PIPE\\initshutdown"#define PIPE_EPM      "\\PIPE\\epmapper"#define PIPE_SVCCTL   "\\PIPE\\svcctl"#define PIPE_EVENTLOG "\\PIPE\\eventlog"#define PIPE_NETLOGON_PLAIN "\\NETLOGON"#define PI_LSARPC		0#define PI_LSARPC_DS		1#define PI_SAMR			2#define PI_NETLOGON		3#define PI_SRVSVC		4#define PI_WKSSVC		5#define PI_WINREG		6#define PI_SPOOLSS		7#define PI_NETDFS		8#define PI_ECHO 		9#define PI_SHUTDOWN		10#define PI_SVCCTL		11#define PI_EVENTLOG 		12#define PI_NTSVCS		13#define PI_MAX_PIPES		14/* 64 bit time (100usec) since ????? - cifs6.txt, section 3.5, page 30 */typedef struct nttime_info {	uint32 low;	uint32 high;} NTTIME;/* Allowable account control bits */#define ACB_DISABLED   0x0001  /* 1 = User account disabled */#define ACB_HOMDIRREQ  0x0002  /* 1 = Home directory required */#define ACB_PWNOTREQ   0x0004  /* 1 = User password not required */#define ACB_TEMPDUP    0x0008  /* 1 = Temporary duplicate account */#define ACB_NORMAL     0x0010  /* 1 = Normal user account */#define ACB_MNS        0x0020  /* 1 = MNS logon user account */#define ACB_DOMTRUST   0x0040  /* 1 = Interdomain trust account */#define ACB_WSTRUST    0x0080  /* 1 = Workstation trust account */#define ACB_SVRTRUST   0x0100  /* 1 = Server trust account (BDC) */#define ACB_PWNOEXP    0x0200  /* 1 = User password does not expire */#define ACB_AUTOLOCK   0x0400  /* 1 = Account auto locked */ #define MAX_HOURS_LEN 32/*  * window during which we must talk to the PDC to avoid * sam sync delays; expressed in seconds (15 minutes is the  * default period for SAM replication under Windows NT 4.0 */#define SAM_SYNC_WINDOW		900#ifndef MAXSUBAUTHS#define MAXSUBAUTHS 15 /* max sub authorities in a SID */#endif#define SID_MAX_SIZE ((size_t)(8+(MAXSUBAUTHS*4)))/* SID Types */enum SID_NAME_USE{	SID_NAME_USE_NONE = 0,	SID_NAME_USER    = 1, /* user */	SID_NAME_DOM_GRP,     /* domain group */	SID_NAME_DOMAIN,      /* domain sid */	SID_NAME_ALIAS,       /* local group */	SID_NAME_WKN_GRP,     /* well-known group */	SID_NAME_DELETED,     /* deleted account: needed for c2 rating */	SID_NAME_INVALID,     /* invalid account */	SID_NAME_UNKNOWN,     /* unknown sid type */	SID_NAME_COMPUTER     /* sid for a computer */};/** * @brief Security Identifier * * @sa http://msdn.microsoft.com/library/default.asp?url=/library/en-us/security/accctrl_38yn.asp **/typedef struct sid_info{  uint8  sid_rev_num;             /**< SID revision number */  uint8  num_auths;               /**< Number of sub-authorities */  uint8  id_auth[6];              /**< Identifier Authority */  /*   *  Pointer to sub-authorities.   *   * @note The values in these uint32's are in *native* byteorder, not   * neccessarily little-endian...... JRA.   */  uint32 sub_auths[MAXSUBAUTHS];  } DOM_SID;/* Some well-known SIDs */extern const DOM_SID global_sid_World_Domain;extern const DOM_SID global_sid_World;extern const DOM_SID global_sid_Creator_Owner_Domain;extern const DOM_SID global_sid_NT_Authority;extern const DOM_SID global_sid_System;extern const DOM_SID global_sid_NULL;extern const DOM_SID global_sid_Authenticated_Users;extern const DOM_SID global_sid_Network;extern const DOM_SID global_sid_Creator_Owner;extern const DOM_SID global_sid_Creator_Group;extern const DOM_SID global_sid_Anonymous;extern const DOM_SID global_sid_Builtin;extern const DOM_SID global_sid_Builtin_Administrators;extern const DOM_SID global_sid_Builtin_Users;extern const DOM_SID global_sid_Builtin_Guests;extern const DOM_SID global_sid_Builtin_Power_Users;extern const DOM_SID global_sid_Builtin_Account_Operators;extern const DOM_SID global_sid_Builtin_Server_Operators;extern const DOM_SID global_sid_Builtin_Print_Operators;extern const DOM_SID global_sid_Builtin_Backup_Operators;extern const DOM_SID global_sid_Builtin_Replicator;/* * The complete list of SIDS belonging to this user. * Created when a vuid is registered. * The definition of the user_sids array is as follows : * * token->user_sids[0] = primary user SID. * token->user_sids[1] = primary group SID. * token->user_sids[2..num_sids] = supplementary group SIDS. */#define PRIMARY_USER_SID_INDEX 0#define PRIMARY_GROUP_SID_INDEX 1typedef struct _nt_user_token {	size_t num_sids;	DOM_SID *user_sids;	SE_PRIV privileges;} NT_USER_TOKEN;/*** query a local group, get a list of these: shows who is in that group ***//* local group member info */typedef struct local_grp_member_info{	DOM_SID sid    ; /* matches with name */	uint8   sid_use; /* usr=1 grp=2 dom=3 alias=4 wkng=5 del=6 inv=7 unk=8 */	fstring name   ; /* matches with sid: must be of the form "DOMAIN\account" */} LOCAL_GRP_MEMBER;/* enumerate these to get list of local groups *//* local group info */typedef struct local_grp_info{	fstring name;	fstring comment;} LOCAL_GRP;/*** enumerate these to get list of domain groups ***//* domain group member info */typedef struct domain_grp_info{	fstring name;	fstring comment;	uint32  rid; /* group rid */	uint8   attr; /* attributes forced to be set to 0x7: SE_GROUP_xxx */} DOMAIN_GRP;/*** query a domain group, get a list of these: shows who is in that group ***//* domain group info */typedef struct domain_grp_member_info{	fstring name;	uint8   attr; /* attributes forced to be set to 0x7: SE_GROUP_xxx */} DOMAIN_GRP_MEMBER;/* 32 bit time (sec) since 01jan1970 - cifs6.txt, section 3.5, page 30 */typedef struct time_info{  uint32 time;} UTIME;/* Structure used when SMBwritebmpx is active */typedef struct {	size_t wr_total_written; /* So we know when to discard this */	int32 wr_timeout;	int32 wr_errclass; /* Cached errors */	int32 wr_error; /* Cached errors */	NTSTATUS wr_status; /* Cached errors */	BOOL  wr_mode; /* write through mode) */	BOOL  wr_discard; /* discard all further data */} write_bmpx_struct;typedef struct write_cache{    SMB_OFF_T file_size;    SMB_OFF_T offset;    size_t alloc_size;    size_t data_size;    char *data;} write_cache;typedef struct{	smb_ucs2_t *origname;	smb_ucs2_t *filename;	SMB_STRUCT_STAT *statinfo;} smb_filename;#include "fake_file.h"struct fd_handle {	size_t ref_count;	int fd;	SMB_BIG_UINT position_information;	SMB_OFF_T pos;	uint32 private_options;	/* NT Create options, but we only look at				 * NTCREATEX_OPTIONS_PRIVATE_DENY_DOS and				 * NTCREATEX_OPTIONS_PRIVATE_DENY_FCB (Except				 * for print files *only*, where				 * DELETE_ON_CLOSE is not stored in the share				 * mode database.				 */};struct timed_event;struct idle_event;struct share_mode_entry;typedef struct files_struct {	struct files_struct *next, *prev;	int fnum;	struct connection_struct *conn;	struct fd_handle *fh;	unsigned int num_smb_operations;	uint16 rap_print_jobid;	SMB_DEV_T dev;	SMB_INO_T inode;	SMB_BIG_UINT initial_allocation_size; /* Faked up initial allocation on disk. */	mode_t mode;	uint16 file_pid;	uint16 vuid;	write_bmpx_struct *wbmpx_ptr;	write_cache *wcp;	struct timeval open_time;	uint32 access_mask;		/* NTCreateX access bits (FILE_READ_DATA etc.) */	uint32 share_access;		/* NTCreateX share constants (FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE). */	BOOL pending_modtime_owner;	time_t pending_modtime;

⌨️ 快捷键说明

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