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

📄 smblib-priv.h

📁 RADIUS 服务器介绍 RADIUS服务器支持标准的RADIUS协议
💻 H
📖 第 1 页 / 共 2 页
字号:
/* UNIX SMBlib NetBIOS implementation   Version 1.0   SMBlib private Defines   Copyright (C) Richard Sharpe 1996*//*   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.*/#include "std-includes.h"#include "smblib-common.h"typedef unsigned short uint16;typedef unsigned int   uint32;#include "byteorder.h"     /* Hmmm ... hot good */#define max(a,b) (a < b ? b : a)#define SMB_DEF_IDF 0x424D53FF        /* "\377SMB" */ /* Core protocol commands */#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 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 *//* CorePlus protocol                                        */#define SMBlockread   0x13  /* Lock a range and read it */#define SMBwriteunlock 0x14 /* Unlock a range and then write */#define SMBreadbraw   0x1a  /* read a block of data without smb header ohead*/#define SMBwritebraw  0x1d  /* write a block of data without smb header ohead*/#define SMBwritec     0x20  /* secondary write request */#define SMBwriteclose 0x2c  /* write a file and 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) */#define SMBtconX         0x75   /* tree connect and X */#define SMBffirst        0x82   /* find first */#define SMBfunique       0x83   /* find unique */#define SMBfclose        0x84   /* find close */#define SMBinvalid       0xFE   /* invalid command *//* Any more ? */#define SMBdatablockID     0x01  /* A data block identifier */#define SMBdialectID       0x02  /* A dialect id            */#define SMBpathnameID      0x03  /* A pathname ID           */#define SMBasciiID         0x04  /* An ascii string ID      */#define SMBvariableblockID 0x05  /* A variable block ID     *//* some other defines we need *//* Flags defines ... */#define SMB_FLG2_NON_DOS    0x01 /* We know non dos names             */#define SMB_FLG2_EXT_ATR    0x02 /* We know about Extended Attributes */#define SMB_FLG2_LNG_NAM    0x04 /* Long names ?                      */typedef unsigned short WORD;typedef unsigned short UWORD;typedef unsigned int ULONG;typedef unsigned char BYTE;typedef unsigned char UCHAR;/* Some macros to allow access to actual packet data so that we *//* can change the underlying representation of packets.         *//*                                                              *//* The current formats vying for attention are a fragment       *//* approach where the SMB header is a fragment linked to the    *//* data portion with the transport protocol (rfcnb or whatever) *//* being linked on the front.                                   *//*                                                              *//* The other approach is where the whole packet is one array    *//* of bytes with space allowed on the front for the packet      *//* headers.                                                     */#define SMB_Hdr(p) (char *)(p -> data)/* SMB Hdr def for File Sharing Protocol? From MS and Intel,    *//* Intel PN 138446 Doc Version 2.0, Nov 7, 1988. This def also  *//* applies to LANMAN1.0 as well as the Core Protocol            *//* The spec states that wct and bcc must be present, even if 0  *//* We define these as offsets into a char SMB[] array for the   *//* sake of portability                                          *//* NOTE!. Some of the lenght defines, SMB_<protreq>_len do not include *//* the data that follows in the SMB packet, so the code will have to   *//* take that into account.                                             */#define SMB_hdr_idf_offset    0          /* 0xFF,'SMB' 0-3 */#define SMB_hdr_com_offset    4          /* BYTE       4   */#define SMB_hdr_rcls_offset   5          /* BYTE       5   */#define SMB_hdr_reh_offset    6          /* BYTE       6   */#define SMB_hdr_err_offset    7          /* WORD       7   */#define SMB_hdr_reb_offset    9          /* BYTE       9   */#define SMB_hdr_flg_offset    9          /* same as reb ...*/#define SMB_hdr_res_offset    10         /* 7 WORDs    10  */#define SMB_hdr_res0_offset   10         /* WORD       10  */#define SMB_hdr_flg2_offset   10         /* WORD           */#define SMB_hdr_res1_offset   12         /* WORD       12  */#define SMB_hdr_res2_offset   14#define SMB_hdr_res3_offset   16#define SMB_hdr_res4_offset   18#define SMB_hdr_res5_offset   20#define SMB_hdr_res6_offset   22#define SMB_hdr_tid_offset    24#define SMB_hdr_pid_offset    26#define SMB_hdr_uid_offset    28#define SMB_hdr_mid_offset    30#define SMB_hdr_wct_offset    32#define SMB_hdr_len           33        /* 33 byte header?      */#define SMB_hdr_axc_offset    33        /* AndX Command         */#define SMB_hdr_axr_offset    34        /* AndX Reserved        */#define SMB_hdr_axo_offset    35     /* Offset from start to WCT of AndX cmd *//* Format of the Negotiate Protocol SMB */#define SMB_negp_bcc_offset   33#define SMB_negp_buf_offset   35        /* Where the buffer starts   */#define SMB_negp_len          35        /* plus the data             *//* Format of the Negotiate Response SMB, for CoreProtocol, LM1.2 and *//* NT LM 0.12. wct will be 1 for CoreProtocol, 13 for LM 1.2, and 17 *//* for NT LM 0.12                                                    */#define SMB_negrCP_idx_offset   33        /* Response to the neg req */#define SMB_negrCP_bcc_offset   35#define SMB_negrLM_idx_offset   33        /* dialect index           */#define SMB_negrLM_sec_offset   35        /* Security mode           */#define SMB_sec_user_mask       0x01      /* 0 = share, 1 = user     */#define SMB_sec_encrypt_mask    0x02      /* pick out encrypt        */#define SMB_negrLM_mbs_offset   37        /* max buffer size         */#define SMB_negrLM_mmc_offset   39        /* max mpx count           */#define SMB_negrLM_mnv_offset   41        /* max number of VCs       */#define SMB_negrLM_rm_offset    43        /* raw mode support bit vec*/#define SMB_read_raw_mask       0x01#define SMB_write_raw_mask      0x02#define SMB_negrLM_sk_offset    45        /* session key, 32 bits    */#define SMB_negrLM_st_offset    49        /* Current server time     */#define SMB_negrLM_sd_offset    51        /* Current server date     */#define SMB_negrLM_stz_offset   53        /* Server Time Zone        */#define SMB_negrLM_ekl_offset   55        /* encryption key length   */#define SMB_negrLM_res_offset   57        /* reserved                */#define SMB_negrLM_bcc_offset   59        /* bcc                     */#define SMB_negrLM_len          61        /* 61 bytes ?              */#define SMB_negrLM_buf_offset   61        /* Where the fun begins    */#define SMB_negrNTLM_idx_offset 33        /* Selected protocol       */#define SMB_negrNTLM_sec_offset 35        /* Security more           */#define SMB_negrNTLM_mmc_offset 36        /* Different format above  */#define SMB_negrNTLM_mnv_offset 38        /* Max VCs                 */#define SMB_negrNTLM_mbs_offset 40        /* MBS now a long          */#define SMB_negrNTLM_mrs_offset 44        /* Max raw size            */#define SMB_negrNTLM_sk_offset  48        /* Session Key             */#define SMB_negrNTLM_cap_offset 52        /* Capabilities            */#define SMB_negrNTLM_stl_offset 56        /* Server time low         */#define SMB_negrNTLM_sth_offset 60        /* Server time high        */#define SMB_negrNTLM_stz_offset 64        /* Server time zone        */#define SMB_negrNTLM_ekl_offset 66        /* Encrypt key len         */#define SMB_negrNTLM_bcc_offset 67        /* Bcc                     */#define SMB_negrNTLM_len        69#define SMB_negrNTLM_buf_offset 69/* Offsets related to Tree Connect                                      */#define SMB_tcon_bcc_offset     33#define SMB_tcon_buf_offset     35        /* where the data is for tcon */#define SMB_tcon_len            35        /* plus the data              */#define SMB_tconr_mbs_offset    33        /* max buffer size         */#define SMB_tconr_tid_offset    35        /* returned tree id        */#define SMB_tconr_bcc_offset    37       #define SMB_tconr_len           39 #define SMB_tconx_axc_offset    33        /* And X Command                */#define SMB_tconx_axr_offset    34        /* reserved                     */#define SMB_tconx_axo_offset    35        /* Next command offset          */#define SMB_tconx_flg_offset    37        /* Flags, bit0=1 means disc TID */#define SMB_tconx_pwl_offset    39        /* Password length              */#define SMB_tconx_bcc_offset    41        /* bcc                          */#define SMB_tconx_buf_offset    43        /* buffer                       */#define SMB_tconx_len           43        /* up to data ...               */#define SMB_tconxr_axc_offset   33        /* Where the AndX Command is    */#define SMB_tconxr_axr_offset   34        /* Reserved                     */#define SMB_tconxr_axo_offset   35        /* AndX offset location         *//* Offsets related to tree_disconnect                                  */#define SMB_tdis_bcc_offset     33        /* bcc                     */#define SMB_tdis_len            35        /* total len               */#define SMB_tdisr_bcc_offset    33        /* bcc                     */#define SMB_tdisr_len           35/* Offsets related to Open Request                                     */#define SMB_open_mod_offset     33        /* Mode to open with       */#define SMB_open_atr_offset     35        /* Attributes of file      */#define SMB_open_bcc_offset     37        /* bcc                     */#define SMB_open_buf_offset     39        /* File name               */#define SMB_open_len            39        /* Plus the file name      */#define SMB_openx_axc_offset    33        /* Next command            */#define SMB_openx_axr_offset    34        /* Reserved                */#define SMB_openx_axo_offset    35        /* offset of next wct      */#define SMB_openx_flg_offset    37        /* Flags, bit0 = need more info */                                          /* bit1 = exclusive oplock */                                          /* bit2 = batch oplock     */#define SMB_openx_mod_offset    39        /* mode to open with       */#define SMB_openx_atr_offset    41        /* search attributes       */#define SMB_openx_fat_offset    43        /* File attributes         */#define SMB_openx_tim_offset    45        /* time and date of creat  */#define SMB_openx_ofn_offset    49        /* Open function           */#define SMB_openx_als_offset    51        /* Space to allocate on    */#define SMB_openx_res_offset    55        /* reserved                */#define SMB_openx_bcc_offset    63        /* bcc                     */#define SMB_openx_buf_offset    65        /* Where file name goes    */#define SMB_openx_len           65#define SMB_openr_fid_offset    33        /* FID returned            */#define SMB_openr_atr_offset    35        /* Attributes opened with  */#define SMB_openr_tim_offset    37        /* Last mod time of file   */#define SMB_openr_fsz_offset    41        /* File size 4 bytes       */#define SMB_openr_acc_offset    45        /* Access allowed          */#define SMB_openr_bcc_offset    47#define SMB_openr_len           49#define SMB_openxr_axc_offset   33        /* And X command           */#define SMB_openxr_axr_offset   34        /* reserved                */#define SMB_openxr_axo_offset   35        /* offset to next command  */#define SMB_openxr_fid_offset   37        /* FID returned            */#define SMB_openxr_fat_offset   39        /* File attributes returned*/#define SMB_openxr_tim_offset   41        /* File creation date etc  */#define SMB_openxr_fsz_offset   45        /* Size of file            */#define SMB_openxr_acc_offset   49        /* Access granted          */

⌨️ 快捷键说明

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