📄 smblib-priv.h
字号:
#define SMB_writr_cnt_offset 33 /* Count of bytes written */#define SMB_writr_bcc_offset 35 /* bcc */#define SMB_writr_len 37/* Offsets related to read requests */#define SMB_read_fid_offset 33 /* FID of file to read */#define SMB_read_cnt_offset 35 /* count of words to read */#define SMB_read_ofs_offset 37 /* Where to read from */#define SMB_read_clf_offset 41 /* Advisory count to go */#define SMB_read_bcc_offset 43#define SMB_read_len 45#define SMB_readr_cnt_offset 33 /* Count of bytes returned */#define SMB_readr_res_offset 35 /* 4 shorts reserved, 8 bytes */#define SMB_readr_bcc_offset 43 /* bcc */#define SMB_readr_bff_offset 45 /* buffer format char = 0x01 */#define SMB_readr_len_offset 46 /* buffer len */#define SMB_readr_len 45 /* length of the readr before data *//* Offsets for Create file */#define SMB_creat_atr_offset 33 /* Attributes of new file ... */#define SMB_creat_tim_offset 35 /* Time of creation */#define SMB_creat_dat_offset 37 /* 4004BCE :-) */#define SMB_creat_bcc_offset 39 /* bcc */#define SMB_creat_buf_offset 41#define SMB_creat_len 41 /* Before the data */#define SMB_creatr_fid_offset 33 /* FID of created file *//* Offsets for Delete file */#define SMB_delet_sat_offset 33 /* search attribites */#define SMB_delet_bcc_offset 35 /* bcc */#define SMB_delet_buf_offset 37#define SMB_delet_len 37/* Offsets for SESSION_SETUP_ANDX for both LM and NT LM protocols */#define SMB_ssetpLM_mbs_offset 37 /* Max buffer Size, allow for AndX */#define SMB_ssetpLM_mmc_offset 39 /* max multiplex count */#define SMB_ssetpLM_vcn_offset 41 /* VC number if new VC */#define SMB_ssetpLM_snk_offset 43 /* Session Key */#define SMB_ssetpLM_pwl_offset 47 /* password length */#define SMB_ssetpLM_res_offset 49 /* reserved */#define SMB_ssetpLM_bcc_offset 53 /* bcc */#define SMB_ssetpLM_len 55 /* before data ... */#define SMB_ssetpLM_buf_offset 55#define SMB_ssetpNTLM_mbs_offset 37 /* Max Buffer Size for NT LM 0.12 */ /* and above */#define SMB_ssetpNTLM_mmc_offset 39 /* Max Multiplex count */#define SMB_ssetpNTLM_vcn_offset 41 /* VC Number */#define SMB_ssetpNTLM_snk_offset 43 /* Session key */#define SMB_ssetpNTLM_cipl_offset 47 /* Case Insensitive PW Len */#define SMB_ssetpNTLM_cspl_offset 49 /* Unicode pw len */#define SMB_ssetpNTLM_res_offset 51 /* reserved */#define SMB_ssetpNTLM_cap_offset 55 /* server capabilities */#define SMB_ssetpNTLM_bcc_offset 59 /* bcc */#define SMB_ssetpNTLM_len 61 /* before data */#define SMB_ssetpNTLM_buf_offset 61#define SMB_ssetpr_axo_offset 35 /* Offset of next response ... */#define SMB_ssetpr_act_offset 37 /* action, bit 0 = 1 => guest */#define SMB_ssetpr_bcc_offset 39 /* bcc */#define SMB_ssetpr_buf_offset 41 /* Native OS etc *//* Offsets for SMB create directory */#define SMB_creatdir_bcc_offset 33 /* only a bcc here */#define SMB_creatdir_buf_offset 35 /* Where things start */#define SMB_creatdir_len 35/* Offsets for SMB delete directory */#define SMB_deletdir_bcc_offset 33 /* only a bcc here */#define SMB_deletdir_buf_offset 35 /* where things start */#define SMB_deletdir_len 35/* Offsets for SMB check directory */#define SMB_checkdir_bcc_offset 33 /* Only a bcc here */#define SMB_checkdir_buf_offset 35 /* where things start */#define SMB_checkdir_len 35/* Offsets for SMB search */#define SMB_search_mdc_offset 33 /* Max Dir ents to return */#define SMB_search_atr_offset 35 /* Search attributes */#define SMB_search_bcc_offset 37 /* bcc */#define SMB_search_buf_offset 39 /* where the action is */#define SMB_search_len 39#define SMB_searchr_dec_offset 33 /* Dir ents returned */#define SMB_searchr_bcc_offset 35 /* bcc */#define SMB_searchr_buf_offset 37 /* Where the action starts */#define SMB_searchr_len 37 /* before the dir ents */#define SMB_searchr_dirent_len 43 /* 53 bytes *//* Defines for SMB transact and transact2 calls */#define SMB_trans_tpc_offset 33 /* Total param count */#define SMB_trans_tdc_offset 35 /* total Data count */#define SMB_trans_mpc_offset 37 /* Max params bytes to return */#define SMB_trans_mdc_offset 39 /* Max data bytes to return */#define SMB_trans_msc_offset 41 /* Max setup words to return */#define SMB_trans_rs1_offset 42 /* Reserved byte */#define SMB_trans_flg_offset 43 /* flags */#define SMB_trans_tmo_offset 45 /* Timeout, long */#define SMB_trans_rs2_offset 49 /* Next reserved */#define SMB_trans_pbc_offset 51 /* Param Byte count in buf */#define SMB_trans_pbo_offset 53 /* Offset to param bytes */#define SMB_trans_dbc_offset 55 /* Data byte count in buf */#define SMB_trans_dbo_offset 57 /* Data byte offset */#define SMB_trans_suc_offset 59 /* Setup count - byte */#define SMB_trans_rs3_offset 60 /* Reserved to pad ... */#define SMB_trans_len 61 /* Up to setup, still need bcc */#define SMB_transr_tpc_offset 33 /* Total param bytes returned */#define SMB_transr_tdc_offset 35#define SMB_transr_rs1_offset 37#define SMB_transr_pbc_offset 39#define SMB_transr_pbo_offset 41#define SMB_transr_pdi_offset 43 /* parameter displacement */#define SMB_transr_dbc_offset 45#define SMB_transr_dbo_offset 47#define SMB_transr_ddi_offset 49#define SMB_transr_suc_offset 51#define SMB_transr_rs2_offset 52#define SMB_transr_len 53/* Bit masks for SMB Capabilities ... */#define SMB_cap_raw_mode 0x0001#define SMB_cap_mpx_mode 0x0002#define SMB_cap_unicode 0x0004#define SMB_cap_large_files 0x0008#define SMB_cap_nt_smbs 0x0010#define SMB_rpc_remote_apis 0x0020#define SMB_cap_nt_status 0x0040#define SMB_cap_level_II_oplocks 0x0080#define SMB_cap_lock_and_read 0x0100#define SMB_cap_nt_find 0x0200/* SMB LANMAN api call defines */#define SMB_LMapi_SetUserInfo 0x0072#define SMB_LMapi_UserPasswordSet 0x0073/* Structures and defines we use in the client interface *//* The protocols we might support. Perhaps a bit ambitious, as only RFCNB *//* has any support so far 0(sometimes called NBT) */typedef enum { SMB_RFCNB, SMB_IPXNB, SMB_NETBEUI, SMB_X25} SMB_Transport_Types;typedef enum { SMB_Con_FShare, SMB_Con_PShare, SMB_Con_IPC} SMB_Con_Types;typedef enum { SMB_State_NoState, SMB_State_Stopped, SMB_State_Started} SMB_State_Types;/* The following two arrays need to be in step! *//* We must make it possible for callers to specify these ... */#if 0extern char *SMB_Prots[];/* * static char *SMB_Prots[] = {"PC NETWORK PROGRAM 1.0", * "MICROSOFT NETWORKS 1.03", * "MICROSOFT NETWORKS 3.0", * "DOS LANMAN1.0", * "LANMAN1.0", * "DOS LM1.2X002", * "LM1.2X002", * "DOS LANMAN2.1", * "LANMAN2.1", * "Samba", * "NT LM 0.12", * "NT LANMAN 1.0", * NULL}; */extern int SMB_Types[];/* * static int SMB_Types[] = {SMB_P_Core, * SMB_P_CorePlus, * SMB_P_DOSLanMan1, * SMB_P_DOSLanMan1, * SMB_P_LanMan1, * SMB_P_DOSLanMan2, * SMB_P_LanMan2, * SMB_P_LanMan2_1, * SMB_P_LanMan2_1, * SMB_P_NT1, * SMB_P_NT1, * SMB_P_NT1, * -1}; */#endiftypedef struct SMB_Status { union { struct { unsigned char ErrorClass; unsigned char Reserved; unsigned short Error; } DosError; unsigned int NtStatus; } status;} SMB_Status;typedef struct SMB_Tree_Structure *SMB_Tree_Handle;typedef struct SMB_Connect_Def *SMB_Handle_Type;struct SMB_Connect_Def { SMB_Handle_Type Next_Con, Prev_Con; /* Next and previous conn */ int protocol; /* What is the protocol */ int prot_IDX; /* And what is the index */ void *Trans_Connect; /* The connection */ /* All these strings should be malloc'd */ char service[80], username[80], password[80], desthost[80], sock_options[80]; char address[80], myname[80]; SMB_Tree_Handle first_tree, last_tree; /* List of trees on this server */ int gid; /* Group ID, do we need it? */ int mid; /* Multiplex ID? We might need one per con */ int pid; /* Process ID */ int uid; /* Authenticated user id. */ /* It is pretty clear that we need to bust some of */ /* these out into a per TCon record, as there may */ /* be multiple TCon's per server, etc ... later */ int port; /* port to use in case not default, this is a TCPism! */ int max_xmit; /* Max xmit permitted by server */ int Security; /* 0 = share, 1 = user */ int Raw_Support; /* bit 0 = 1 = Read Raw supported, 1 = 1 Write raw */ BOOL encrypt_passwords; /* FALSE = don't */ int MaxMPX, MaxVC, MaxRaw; unsigned int SessionKey, Capabilities; int SvrTZ; /* Server Time Zone */ int Encrypt_Key_Len; char Encrypt_Key[80], Domain[80], PDomain[80], OSName[80], LMType[40]; char Svr_OS[80], Svr_LMType[80], Svr_PDom[80];};#ifndef SMBLIB_DEFAULT_DOMAIN#define SMBLIB_DEFAULT_DOMAIN "STAFF"#endif#define SMBLIB_DEFAULT_OSNAME "UNIX of some type"#define SMBLIB_DEFAULT_LMTYPE "SMBlib LM2.1 minus a bit"#define SMBLIB_MAX_XMIT 65535#define SMB_Sec_Mode_Share 0#define SMB_Sec_Mode_User 1/* A Tree_Structure */struct SMB_Tree_Structure { SMB_Tree_Handle next, prev; SMB_Handle_Type con; char path[129]; char device_type[20]; int mbs; /* Local MBS */ int tid;};typedef struct SMB_File_Def SMB_File;struct SMB_File_Def { SMB_Tree_Handle tree; char filename[256]; /* We should malloc this ... */ UWORD fid; unsigned int lastmod; unsigned int size; /* Could blow up if 64bit files supported */ UWORD access; off_t fileloc;};/* global Variables for the library */extern SMB_State_Types SMBlib_State;#ifndef SMBLIB_ERRNOextern int SMBlib_errno;extern int SMBlib_SMB_Error; /* last Error */#endifSMB_Tree_Handle SMB_TreeConnect(SMB_Handle_Type con, SMB_Tree_Handle tree, char *path, char *password, char *dev);int SMB_Init();void SMB_Get_My_Name(char *name, int len);int SMB_Negotiate(SMB_Handle_Type Con_Handle, char *Prots[]);int SMB_Discon(SMB_Handle_Type Con_Handle, BOOL KeepHandle);int SMB_Logon_Server(SMB_Handle_Type Con_Handle, char *UserName, char *PassWord, char *UserDomain, int precrypted);int SMB_Get_Error_Msg(int msg, char *msgbuf, int len);int SMB_Get_Last_Error();#endif /* __SMBLIB_PRIV_H__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -