📄 libsmbclient.h
字号:
/*===================================================================== Unix SMB/Netbios implementation. SMB client library API definitions Copyright (C) Andrew Tridgell 1998 Copyright (C) Richard Sharpe 2000 Copyright (C) John Terpsra 2000 Copyright (C) Tom Jansen (Ninja ISD) 2002 Copyright (C) Derrell Lipman 2003 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 SMBCLIENT_H_INCLUDED#define SMBCLIENT_H_INCLUDED#ifdef __cplusplusextern "C" {#endif/*-------------------------------------------------------------------*//* The following are special comments to instruct DOXYGEN (automated * documentation tool:*//** \defgroup libsmbclient*//** \defgroup structure Data Structures Type and Constants* \ingroup libsmbclient* Data structures, types, and constants*//** \defgroup callback Callback function types* \ingroup libsmbclient* Callback functions*//** \defgroup file File Functions* \ingroup libsmbclient* Functions used to access individual file contents*//** \defgroup directory Directory Functions* \ingroup libsmbclient* Functions used to access directory entries*//** \defgroup attribute Attributes Functions* \ingroup libsmbclient* Functions used to view or change file and directory attributes*//** \defgroup print Print Functions* \ingroup libsmbclient* Functions used to access printing functionality*//** \defgroup misc Miscellaneous Functions* \ingroup libsmbclient* Functions that don't fit in to other categories*//*-------------------------------------------------------------------*/ /* Make sure we have the following includes for now ... */#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <utime.h>#define SMBC_BASE_FD 10000 /* smallest file descriptor returned */#define SMBC_WORKGROUP 1#define SMBC_SERVER 2#define SMBC_FILE_SHARE 3#define SMBC_PRINTER_SHARE 4#define SMBC_COMMS_SHARE 5#define SMBC_IPC_SHARE 6#define SMBC_DIR 7#define SMBC_FILE 8#define SMBC_LINK 9/**@ingroup structure * Structure that represents a directory entry. * */struct smbc_dirent { /** Type of entity. SMBC_WORKGROUP=1, SMBC_SERVER=2, SMBC_FILE_SHARE=3, SMBC_PRINTER_SHARE=4, SMBC_COMMS_SHARE=5, SMBC_IPC_SHARE=6, SMBC_DIR=7, SMBC_FILE=8, SMBC_LINK=9,*/ unsigned int smbc_type; /** Length of this smbc_dirent in bytes */ unsigned int dirlen; /** The length of the comment string in bytes (does not include * null terminator) */ unsigned int commentlen; /** Points to the null terminated comment string */ char *comment; /** The length of the name string in bytes (does not include * null terminator) */ unsigned int namelen; /** Points to the null terminated name string */ char name[1];};/* * Flags for smbc_setxattr() * Specify a bitwise OR of these, or 0 to add or replace as necessary */#define SMBC_XATTR_FLAG_CREATE 0x1 /* fail if attr already exists */#define SMBC_XATTR_FLAG_REPLACE 0x2 /* fail if attr does not exist *//* * Mappings of the DOS mode bits, as returned by smbc_getxattr() when the * attribute name "system.dos_attr.mode" (or "system.dos_attr.*" or * "system.*") is specified. */#define SMBC_DOS_MODE_READONLY 0x01#define SMBC_DOS_MODE_HIDDEN 0x02#define SMBC_DOS_MODE_SYSTEM 0x04#define SMBC_DOS_MODE_VOLUME_ID 0x08#define SMBC_DOS_MODE_DIRECTORY 0x10#define SMBC_DOS_MODE_ARCHIVE 0x20#ifndef ENOATTR# define ENOATTR ENOENT /* No such attribute */#endif/**@ingroup structure * Structure that represents a print job. * */#ifndef _CLIENT_Hstruct print_job_info { /** numeric ID of the print job */ unsigned short id; /** represents print job priority (lower numbers mean higher priority) */ unsigned short priority; /** Size of the print job */ size_t size; /** Name of the user that owns the print job */ char user[128]; /** Name of the print job. This will have no name if an anonymous print * file was opened. Ie smb://server/printer */ char name[128]; /** Time the print job was spooled */ time_t t;};#endif /* _CLIENT_H *//**@ingroup structure * Server handle */typedef struct _SMBCSRV SMBCSRV;/**@ingroup structure * File or directory handle */typedef struct _SMBCFILE SMBCFILE;/**@ingroup structure * File or directory handle */typedef struct _SMBCCTX SMBCCTX;/**@ingroup callback * Authentication callback function type. * * Type for the the authentication function called by the library to * obtain authentication credentals * * @param srv Server being authenticated to * * @param shr Share being authenticated to * * @param wg Pointer to buffer containing a "hint" for the * workgroup to be authenticated. Should be filled in * with the correct workgroup if the hint is wrong. * * @param wglen The size of the workgroup buffer in bytes * * @param un Pointer to buffer containing a "hint" for the * user name to be use for authentication. Should be * filled in with the correct workgroup if the hint is * wrong. * * @param unlen The size of the username buffer in bytes * * @param pw Pointer to buffer containing to which password * copied * * @param pwlen The size of the password buffer in bytes * */typedef void (*smbc_get_auth_data_fn)(const char *srv, const char *shr, char *wg, int wglen, char *un, int unlen, char *pw, int pwlen);/**@ingroup callback * Print job info callback function type. * * @param i pointer to print job information structure * */ typedef void (*smbc_list_print_job_fn)(struct print_job_info *i); /**@ingroup callback * Check if a server is still good * * @param c pointer to smb context * * @param srv pointer to server to check * * @return 0 when connection is good. 1 on error. * */ typedef int (*smbc_check_server_fn)(SMBCCTX * c, SMBCSRV *srv);/**@ingroup callback * Remove a server if unused * * @param c pointer to smb context * * @param srv pointer to server to remove * * @return 0 on success. 1 on failure. * */ typedef int (*smbc_remove_unused_server_fn)(SMBCCTX * c, SMBCSRV *srv);/**@ingroup callback * Add a server to the cache system * * @param c pointer to smb context * * @param srv pointer to server to add * * @param server server name * * @param share share name * * @param workgroup workgroup used to connect * * @param username username used to connect * * @return 0 on success. 1 on failure. * */ typedef int (*smbc_add_cached_srv_fn) (SMBCCTX * c, SMBCSRV *srv, const char * server, const char * share, const char * workgroup, const char * username);/**@ingroup callback * Look up a server in the cache system * * @param c pointer to smb context * * @param server server name to match * * @param share share name to match * * @param workgroup workgroup to match * * @param username username to match * * @return pointer to SMBCSRV on success. NULL on failure. * */ typedef SMBCSRV * (*smbc_get_cached_srv_fn) (SMBCCTX * c, const char * server, const char * share, const char * workgroup, const char * username);/**@ingroup callback * Check if a server is still good * * @param c pointer to smb context * * @param srv pointer to server to remove * * @return 0 when found and removed. 1 on failure. * */ typedef int (*smbc_remove_cached_srv_fn)(SMBCCTX * c, SMBCSRV *srv);/**@ingroup callback * Try to remove all servers from the cache system and disconnect * * @param c pointer to smb context * * @return 0 when found and removed. 1 on failure.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -