s3-selftest: add new registry upgrade test to test list
[Samba/gebeck_regimport.git] / examples / libsmbclient / smbwrapper / wrapper.h
blobe83bb1ee5d7f19f8230c6b61d5bc03a2bb4a280f
1 /*
2 Unix SMB/Netbios implementation.
3 Version 2.0
4 SMB wrapper functions
5 Copyright (C) Derrell Lipman 2003-2005
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #ifndef __WRAPPER_H__
22 #define __WRAPPER_H__
24 #include <sys/stat.h>
25 #include <sys/select.h>
26 #include <sys/time.h>
27 #include <sys/types.h>
28 #include <unistd.h>
29 #include <dirent.h>
30 #include <utime.h>
31 #include <signal.h>
32 #include <stdio.h>
34 #ifndef __FD_SETSIZE
35 # define __FD_SETSIZE 256
36 #endif
38 extern int smbw_fd_map[__FD_SETSIZE];
39 extern int smbw_ref_count[__FD_SETSIZE];
40 extern char smbw_cwd[PATH_MAX];
41 extern char smbw_prefix[];
43 typedef struct SMBW_stat {
44 unsigned long s_dev; /* device */
45 unsigned long s_ino; /* inode */
46 unsigned long s_mode; /* protection */
47 unsigned long s_nlink; /* number of hard links */
48 unsigned long s_uid; /* user ID of owner */
49 unsigned long s_gid; /* group ID of owner */
50 unsigned long s_rdev; /* device type (if inode device) */
51 unsigned long long s_size; /* total size, in bytes */
52 unsigned long s_blksize; /* blocksize for filesystem I/O */
53 unsigned long s_blocks; /* number of blocks allocated */
54 unsigned long s_atime; /* time of last access */
55 unsigned long s_mtime; /* time of last modification */
56 unsigned long s_ctime; /* time of last change */
57 } SMBW_stat;
59 typedef struct SMBW_dirent {
60 unsigned long d_ino; /* inode number */
61 unsigned long long d_off; /* offset to the next dirent */
62 unsigned long d_reclen; /* length of this record */
63 unsigned long d_type; /* type of file */
64 char d_name[256]; /* filename */
65 char d_comment[256]; /* comment */
66 } SMBW_dirent;
68 struct kernel_sigaction {
69 __sighandler_t k_sa_handler;
70 unsigned long sa_flags;
71 sigset_t sa_mask;
74 typedef struct SMBW_libc
76 /* write() is first, to allow debugging */
77 ssize_t (* write)(int fd, void *buf, size_t count);
78 int (* open)(char *name, int flags, mode_t mode);
79 int (* _open)(char *name, int flags, mode_t mode) ;
80 int (* __open)(char *name, int flags, mode_t mode) ;
81 int (* open64)(char *name, int flags, mode_t mode);
82 int (* _open64)(char *name, int flags, mode_t mode) ;
83 int (* __open64)(char *name, int flags, mode_t mode) ;
84 ssize_t (* pread)(int fd, void *buf, size_t size, off_t ofs);
85 ssize_t (* pread64)(int fd, void *buf, size_t size, off64_t ofs);
86 ssize_t (* pwrite)(int fd, void *buf, size_t size, off_t ofs);
87 ssize_t (* pwrite64)(int fd, void *buf, size_t size, off64_t ofs);
88 int (* close)(int fd);
89 int (* __close)(int fd);
90 int (* _close)(int fd);
91 int (* fcntl)(int fd, int cmd, long arg);
92 int (* __fcntl)(int fd, int cmd, long arg);
93 int (* _fcntl)(int fd, int cmd, long arg);
94 int (* getdents)(int fd, struct dirent *dirp, unsigned int count);
95 int (* __getdents)(int fd, struct dirent *dirp, unsigned int count);
96 int (* _getdents)(int fd, struct dirent *dirp, unsigned int count);
97 int (* getdents64)(int fd, struct dirent64 *dirp, unsigned int count);
98 off_t (* lseek)(int fd, off_t offset, int whence);
99 off_t (* __lseek)(int fd, off_t offset, int whence);
100 off_t (* _lseek)(int fd, off_t offset, int whence);
101 off64_t (* lseek64)(int fd, off64_t offset, int whence);
102 off64_t (* __lseek64)(int fd, off64_t offset, int whence);
103 off64_t (* _lseek64)(int fd, off64_t offset, int whence);
104 ssize_t (* read)(int fd, void *buf, size_t count);
105 ssize_t (* __read)(int fd, void *buf, size_t count);
106 ssize_t (* _read)(int fd, void *buf, size_t count);
107 ssize_t (* __write)(int fd, void *buf, size_t count);
108 ssize_t (* _write)(int fd, void *buf, size_t count);
109 int (* access)(char *name, int mode);
110 int (* chmod)(char *name, mode_t mode);
111 int (* fchmod)(int fd, mode_t mode);
112 int (* chown)(char *name, uid_t owner, gid_t group);
113 int (* fchown)(int fd, uid_t owner, gid_t group);
114 int (* __xstat)(int vers, char *name, struct stat *st);
115 char * ( *getcwd)(char *buf, size_t size);
116 int (* mkdir)(char *name, mode_t mode);
117 int (* __fxstat)(int vers, int fd, struct stat *st);
118 int (* __lxstat)(int vers, char *name, struct stat *st);
119 int (* stat)(char *name, struct stat *st);
120 int (* lstat)(char *name, struct stat *st);
121 int (* fstat)(int fd, struct stat *st);
122 int (* unlink)(char *name);
123 int (* utime)(char *name, struct utimbuf *tvp);
124 int (* utimes)(char *name, struct timeval *tvp);
125 int (* readlink)(char *path, char *buf, size_t bufsize);
126 int (* rename)(char *oldname, char *newname);
127 int (* rmdir)(char *name);
128 int (* symlink)(char *topath, char *frompath);
129 int (* dup)(int fd);
130 int (* dup2)(int oldfd, int newfd);
131 DIR * (* opendir)(char *name);
132 struct dirent * (* readdir)(DIR *dir);
133 int (* closedir)(DIR *dir);
134 off_t (* telldir)(DIR *dir);
135 void (* seekdir)(DIR *dir, off_t offset);
136 int (* creat)(char *path, mode_t mode);
137 int (* creat64)(char *path, mode_t mode);
138 int (* __xstat64)(int ver, char *name, struct stat64 *st64);
139 int (* stat64)(char *name, struct stat64 *st64);
140 int (* __fxstat64)(int ver, int fd, struct stat64 *st64);
141 int (* fstat64)(int fd, struct stat64 *st64);
142 int (* __lxstat64)(int ver, char *name, struct stat64 *st64);
143 int (* lstat64)(char *name, struct stat64 *st64);
144 int (* _llseek)(unsigned int fd, unsigned long offset_high, unsigned long offset_low, loff_t *result, unsigned int whence);
145 struct dirent64 * (* readdir64)(DIR *dir);
146 int (* readdir_r)(DIR *dir, struct dirent *entry, struct dirent **result);
147 int (* readdir64_r)(DIR *dir, struct dirent64 *entry, struct dirent64 **result);
148 int (* setxattr)(const char *fname,
149 const char *name,
150 const void *value,
151 size_t size,
152 int flags);
153 int (* lsetxattr)(const char *fname,
154 const char *name,
155 const void *value,
156 size_t size,
157 int flags);
158 int (* fsetxattr)(int smbw_fd,
159 const char *name,
160 const void *value,
161 size_t size,
162 int flags);
163 int (* getxattr)(const char *fname,
164 const char *name,
165 const void *value,
166 size_t size);
167 int (* lgetxattr)(const char *fname,
168 const char *name,
169 const void *value,
170 size_t size);
171 int (* fgetxattr)(int smbw_fd,
172 const char *name,
173 const void *value,
174 size_t size);
175 int (* removexattr)(const char *fname,
176 const char *name);
177 int (* lremovexattr)(const char *fname,
178 const char *name);
179 int (* fremovexattr)(int smbw_fd,
180 const char *name);
181 int (* listxattr)(const char *fname,
182 char *list,
183 size_t size);
184 int (* llistxattr)(const char *fname,
185 char *list,
186 size_t size);
187 int (* flistxattr)(int smbw_fd,
188 char *list,
189 size_t size);
190 int (* chdir)(const char *path);
191 int (* fchdir)(int fd);
192 pid_t (* fork)(void);
193 int (* select)(int n,
194 fd_set *readfds,
195 fd_set *writefds,
196 fd_set *exceptfds,
197 struct timeval *timeout);
198 int (* _select)(int n,
199 fd_set *readfds,
200 fd_set *writefds,
201 fd_set *exceptfds,
202 struct timeval *timeout);
203 int (* __select)(int n,
204 fd_set *readfds,
205 fd_set *writefds,
206 fd_set *exceptfds,
207 struct timeval *timeout);
208 } SMBW_libc_pointers;
210 extern SMBW_libc_pointers smbw_libc;
212 #endif /* __WRAPPER_H__ */