• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt/router/samba-3.5.8/examples/libsmbclient/smbwrapper/
1/*
2   Unix SMB/Netbios implementation.
3   Version 2.0
4   SMB wrapper functions - definitions
5   Copyright (C) Andrew Tridgell 1998
6   Copyright (C) Derrell Lipman 2003-2005
7
8   This program is free software; you can redistribute it and/or modify
9   it under the terms of the GNU General Public License as published by
10   the Free Software Foundation; either version 3 of the License, or
11   (at your option) any later version.
12
13   This program is distributed in the hope that it will be useful,
14   but WITHOUT ANY WARRANTY; without even the implied warranty of
15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16   GNU General Public License for more details.
17
18   You should have received a copy of the GNU General Public License
19   along with this program.  If not, see <http://www.gnu.org/licenses/>.
20*/
21
22#ifndef _SMBW_H
23#define _SMBW_H
24
25#include <sys/types.h>
26#include <errno.h>
27#include <malloc.h>
28#include <limits.h>
29#include <stdlib.h>
30#include <string.h>
31#include <time.h>
32#include "config.h"             /* must come before libsmbclient.h */
33#include "libsmbclient.h"
34#include "wrapper.h"
35
36#ifndef __restrict
37#  define __restrict
38#endif
39
40#undef DEBUG
41#define DEBUG(level, s) do { if (level <= debug_level) printf s; } while (0)
42
43
44#define SMBW_PREFIX "/smb"
45#define SMBW_DUMMY "/dev/null"
46
47extern int smbw_initialized;
48#define SMBW_INIT()     do { if (! smbw_initialized) smbw_init(); } while (0)
49
50#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T)
51#  define SMBW_OFF_T off64_t
52#else
53#  define SMBW_OFF_T off_t
54#endif
55
56
57/* The following definitions come from  smbwrapper/smbw.c  */
58
59typedef enum {
60        SMBW_RCT_Increment,
61        SMBW_RCT_Decrement,
62        SMBW_RCT_Get,
63        SMBW_RCT_Set
64} Ref_Count_Type;
65
66int smbw_ref(int client_fd, Ref_Count_Type type, ...);
67void smbw_init(void);
68int smbw_fd(int fd);
69int smbw_path(const char *path);
70void smbw_clean_fname(char *name);
71void smbw_fix_path(const char *src, char *dest);
72void smbw_set_auth_data_fn(smbc_get_auth_data_fn fn);
73int smbw_open(const char *fname, int flags, mode_t mode);
74ssize_t smbw_pread(int fd, void *buf, size_t count, SMBW_OFF_T ofs);
75ssize_t smbw_read(int fd, void *buf, size_t count);
76ssize_t smbw_write(int fd, void *buf, size_t count);
77ssize_t smbw_pwrite(int fd, void *buf, size_t count, SMBW_OFF_T ofs);
78int smbw_close(int fd);
79int smbw_fcntl(int fd, int cmd, long arg);
80int smbw_access(const char *name, int mode);
81int smbw_readlink(const char *path, char *buf, size_t bufsize);
82int smbw_unlink(const char *fname);
83int smbw_rename(const char *oldname, const char *newname);
84int smbw_utime(const char *fname, void *buf);
85int smbw_utimes(const char *fname, void *buf);
86int smbw_chown(const char *fname, uid_t owner, gid_t group);
87int smbw_chmod(const char *fname, mode_t newmode);
88SMBW_OFF_T smbw_lseek(int smbw_fd, SMBW_OFF_T offset, int whence);
89int smbw_dup(int fd);
90int smbw_dup2(int fd, int fd2);
91int smbw_fork(void);
92
93/* The following definitions come from  smbwrapper/smbw_dir.c  */
94
95int smbw_dirp(DIR * dirp);
96int smbw_dir_open(const char *fname);
97int smbw_dir_fstat(int fd, SMBW_stat *st);
98int smbw_dir_close(int fd);
99int smbw_getdents(unsigned int fd, SMBW_dirent *dirp, int count);
100int smbw_chdir(const char *name);
101int smbw_mkdir(const char *fname, mode_t mode);
102int smbw_rmdir(const char *fname);
103char *smbw_getcwd(char *buf, size_t size);
104int smbw_fchdir(int fd);
105DIR *smbw_opendir(const char *fname);
106SMBW_dirent *smbw_readdir(DIR *dirp);
107int smbw_readdir_r(DIR *dirp,
108                   struct SMBW_dirent *__restrict entry,
109                   struct SMBW_dirent **__restrict result);
110int smbw_closedir(DIR *dirp);
111void smbw_seekdir(DIR *dirp, long long offset);
112long long smbw_telldir(DIR *dirp);
113int smbw_setxattr(const char *fname,
114                  const char *name,
115                  const void *value,
116                  size_t size,
117                  int flags);
118int smbw_lsetxattr(const char *fname,
119                   const char *name,
120                   const void *value,
121                   size_t size,
122                   int flags);
123int smbw_fsetxattr(int smbw_fd,
124                   const char *name,
125                   const void *value,
126                   size_t size,
127                   int flags);
128int smbw_getxattr(const char *fname,
129                  const char *name,
130                  const void *value,
131                  size_t size);
132int smbw_lgetxattr(const char *fname,
133                   const char *name,
134                   const void *value,
135                   size_t size);
136int smbw_fgetxattr(int smbw_fd,
137                   const char *name,
138                   const void *value,
139                   size_t size);
140int smbw_removexattr(const char *fname,
141                     const char *name);
142int smbw_lremovexattr(const char *fname,
143                      const char *name);
144int smbw_fremovexattr(int smbw_fd,
145                      const char *name);
146int smbw_listxattr(const char *fname,
147                   char *list,
148                   size_t size);
149int smbw_llistxattr(const char *fname,
150                    char *list,
151                    size_t size);
152int smbw_flistxattr(int smbw_fd,
153                    char *list,
154                    size_t size);
155
156/* The following definitions come from  smbwrapper/smbw_stat.c  */
157
158int smbw_fstat(int fd, SMBW_stat *st);
159int smbw_stat(const char *fname, SMBW_stat *st);
160
161/* The following definitions come from smbwrapper/cache.c */
162int
163smbw_cache_functions(SMBCCTX * context);
164
165
166#endif /* _SMBW_H */
167