1 | #ifndef _SMBWRP_H
|
---|
2 | #define _SMBWRP_H
|
---|
3 |
|
---|
4 | #if !defined (O_RDONLY)
|
---|
5 | #define O_ACCMODE 0x03 /* mask */
|
---|
6 | #define O_RDONLY 0x00
|
---|
7 | #define O_WRONLY 0x01
|
---|
8 | #define O_RDWR 0x02
|
---|
9 | #define O_NONBLOCK 0x04
|
---|
10 | #define O_APPEND 0x08
|
---|
11 | #define O_TEXT 0x10
|
---|
12 |
|
---|
13 | #define O_BINARY 0x0100
|
---|
14 | #define O_CREAT 0x0200
|
---|
15 | #define O_TRUNC 0x0400
|
---|
16 | #define O_EXCL 0x0800
|
---|
17 | #define O_SYNC 0x2000
|
---|
18 | #define O_NOCTTY 0x4000
|
---|
19 | #define O_SIZE 0x8000
|
---|
20 | #endif
|
---|
21 |
|
---|
22 | #if !defined (DENY_NONE)
|
---|
23 | /* deny modes */
|
---|
24 | #define DENY_DOS 0
|
---|
25 | #define DENY_ALL 1
|
---|
26 | #define DENY_WRITE 2
|
---|
27 | #define DENY_READ 3
|
---|
28 | #define DENY_NONE 4
|
---|
29 | #define DENY_FCB 7
|
---|
30 | #endif
|
---|
31 |
|
---|
32 |
|
---|
33 | /* these define the attribute byte as seen by DOS */
|
---|
34 | #ifndef aRONLY
|
---|
35 | #define aRONLY (1L<<0) /* 0x01 */
|
---|
36 | #define aHIDDEN (1L<<1) /* 0x02 */
|
---|
37 | #define aSYSTEM (1L<<2) /* 0x04 */
|
---|
38 | #define aVOLID (1L<<3) /* 0x08 */
|
---|
39 | #define aDIR (1L<<4) /* 0x10 */
|
---|
40 | #define aARCH (1L<<5) /* 0x20 */
|
---|
41 | #endif
|
---|
42 |
|
---|
43 | #pragma pack(1)
|
---|
44 |
|
---|
45 | #ifdef CLI_BUFFER_SIZE
|
---|
46 | typedef struct cli_state cli_state;
|
---|
47 | #else
|
---|
48 | typedef unsigned long cli_state;
|
---|
49 | #endif
|
---|
50 |
|
---|
51 | #define CAP_NOPATHINFO2 0x01000000
|
---|
52 |
|
---|
53 | typedef struct smbwrp_server
|
---|
54 | {
|
---|
55 | char server_name[256];
|
---|
56 | char share_name[256];
|
---|
57 | char workgroup[256];
|
---|
58 | char username[256];
|
---|
59 | char password[256];
|
---|
60 | char master[256];
|
---|
61 | int ifmastergroup;
|
---|
62 | int no_pathinfo2;
|
---|
63 | } smbwrp_server;
|
---|
64 |
|
---|
65 | typedef struct smbwrp_file
|
---|
66 | {
|
---|
67 | int fd;
|
---|
68 | unsigned long long offset;
|
---|
69 | int openmode;
|
---|
70 | int openattr;
|
---|
71 | int denymode;
|
---|
72 | unsigned long mtime;
|
---|
73 | char fullname[261];
|
---|
74 | char fname[261];
|
---|
75 | } smbwrp_file;
|
---|
76 |
|
---|
77 | typedef struct smbwrp_fileinfo
|
---|
78 | {
|
---|
79 | unsigned long long size;
|
---|
80 | unsigned long attr;
|
---|
81 | unsigned long ctime;
|
---|
82 | unsigned long mtime;
|
---|
83 | unsigned long atime;
|
---|
84 | int easize;
|
---|
85 | char fname[261];
|
---|
86 | } smbwrp_fileinfo;
|
---|
87 |
|
---|
88 | typedef struct smbwrp_fileseek
|
---|
89 | {
|
---|
90 | int whence;
|
---|
91 | long offset;
|
---|
92 | unsigned long result;
|
---|
93 | } smbwrp_fileseek;
|
---|
94 |
|
---|
95 |
|
---|
96 | #ifndef INCL_DOS
|
---|
97 | typedef struct _FSALLOCATE /* fsalloc */
|
---|
98 | {
|
---|
99 | unsigned long idFileSystem;
|
---|
100 | unsigned long cSectorUnit;
|
---|
101 | unsigned long cUnit;
|
---|
102 | unsigned long cUnitAvail;
|
---|
103 | unsigned short cbSector;
|
---|
104 | } FSALLOCATE;
|
---|
105 | #endif
|
---|
106 |
|
---|
107 | typedef struct _Resource
|
---|
108 | {
|
---|
109 | int rootlevel;
|
---|
110 | smbwrp_server srv;
|
---|
111 | char logfile[_MAX_PATH + 1];
|
---|
112 | char loglevel;
|
---|
113 | int easupport;
|
---|
114 | int krb5support;
|
---|
115 | } Resource;
|
---|
116 |
|
---|
117 | typedef struct _Connection
|
---|
118 | {
|
---|
119 | Resource *pRes;
|
---|
120 | cli_state* cli;
|
---|
121 | smbwrp_file file;
|
---|
122 | } Connection;
|
---|
123 |
|
---|
124 |
|
---|
125 | typedef struct filelist_state
|
---|
126 | {
|
---|
127 | unsigned long pipe;
|
---|
128 | char * data;
|
---|
129 | int datalen;
|
---|
130 | int bufferlen;
|
---|
131 | void ( * _System add_dir_entry)(void * st);
|
---|
132 | char mask[ _MAX_PATH];
|
---|
133 | char dir[ _MAX_PATH];
|
---|
134 | char dir_mask[ _MAX_PATH];
|
---|
135 | smbwrp_fileinfo finfo;
|
---|
136 | Connection* pConn;
|
---|
137 | void *plist;
|
---|
138 | unsigned long ulAttribute;
|
---|
139 | } filelist_state;
|
---|
140 |
|
---|
141 | #pragma pack()
|
---|
142 |
|
---|
143 | int _System smbwrp_getclisize(void);
|
---|
144 | int _System smbwrp_init(void);
|
---|
145 | int _System smbwrp_connect(Resource * pRes, cli_state **);
|
---|
146 | void _System smbwrp_disconnect(Resource * pRes, cli_state *);
|
---|
147 | int _System smbwrp_open(cli_state * cli, smbwrp_file * file);
|
---|
148 | int _System smbwrp_read(cli_state * cli, smbwrp_file * file, void *buf, unsigned long count, unsigned long * result);
|
---|
149 | int _System smbwrp_write(cli_state * cli, smbwrp_file * file, void *buf, unsigned long count, unsigned long * result);
|
---|
150 | int _System smbwrp_lseek(cli_state * cli, smbwrp_file * file, int whence, long long offset);
|
---|
151 | int _System smbwrp_close(cli_state * cli, smbwrp_file * file);
|
---|
152 | int _System smbwrp_setattr(cli_state * cli, smbwrp_fileinfo *finfo);
|
---|
153 | int _System smbwrp_getattr(smbwrp_server *srv, cli_state * cli, smbwrp_fileinfo *finfo);
|
---|
154 | int _System smbwrp_fgetattr(cli_state * cli, smbwrp_file *file, smbwrp_fileinfo *finfo);
|
---|
155 | int _System smbwrp_filelist(smbwrp_server *srv, cli_state * cli, filelist_state * state);
|
---|
156 | int _System smbwrp_rename(cli_state * cli, char *oldname, char *newname);
|
---|
157 | int _System smbwrp_chdir(smbwrp_server *srv, cli_state * cli, char *fname);
|
---|
158 | int _System smbwrp_mkdir(cli_state * cli, char *fname);
|
---|
159 | int _System smbwrp_rmdir(cli_state * cli, char *fname);
|
---|
160 | int _System smbwrp_unlink(cli_state * cli, const char *fname);
|
---|
161 | int _System smbwrp_setfilesize(cli_state * cli, smbwrp_file * file, long long newsize);
|
---|
162 | int _System smbwrp_setea(cli_state * cli, char *fname, char * name, unsigned char * value, int size);
|
---|
163 | int _System smbwrp_fsetea(cli_state * cli, smbwrp_file *file, char * name, unsigned char * value, int size);
|
---|
164 | int _System smbwrp_listea(cli_state * cli, char *fname, void * buffer, unsigned long size);
|
---|
165 | int _System smbwrp_flistea(cli_state * cli, smbwrp_file *file, void * buffer, unsigned long size);
|
---|
166 | int _System smbwrp_dskattr(cli_state * cli, FSALLOCATE *pfsa);
|
---|
167 |
|
---|
168 | #endif /* _SMBWRP_H */
|
---|