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 | typedef struct filelist_state
|
---|
97 | {
|
---|
98 | unsigned long pipe;
|
---|
99 | char * data;
|
---|
100 | int datalen;
|
---|
101 | int bufferlen;
|
---|
102 | void ( * _System add_dir_entry)(void * st);
|
---|
103 | char mask[261];
|
---|
104 | smbwrp_fileinfo finfo;
|
---|
105 | } filelist_state;
|
---|
106 |
|
---|
107 | #ifndef INCL_DOS
|
---|
108 | typedef struct _FSALLOCATE /* fsalloc */
|
---|
109 | {
|
---|
110 | unsigned long idFileSystem;
|
---|
111 | unsigned long cSectorUnit;
|
---|
112 | unsigned long cUnit;
|
---|
113 | unsigned long cUnitAvail;
|
---|
114 | unsigned short cbSector;
|
---|
115 | } FSALLOCATE;
|
---|
116 | #endif
|
---|
117 |
|
---|
118 |
|
---|
119 | #pragma pack()
|
---|
120 |
|
---|
121 | int _System smbwrp_getclisize(void);
|
---|
122 | int _System smbwrp_init(void);
|
---|
123 | int _System smbwrp_connect(smbwrp_server * srv, cli_state ** c);
|
---|
124 | void _System smbwrp_disconnect(cli_state ** cli);
|
---|
125 | int _System smbwrp_open(cli_state * cli, smbwrp_file * file);
|
---|
126 | int _System smbwrp_read(cli_state * cli, smbwrp_file * file, void *buf, unsigned long count, unsigned long * result);
|
---|
127 | int _System smbwrp_write(cli_state * cli, smbwrp_file * file, void *buf, unsigned long count, unsigned long * result);
|
---|
128 | int _System smbwrp_lseek(cli_state * cli, smbwrp_file * file, int whence, long long offset);
|
---|
129 | int _System smbwrp_close(cli_state * cli, smbwrp_file * file);
|
---|
130 | int _System smbwrp_setattr(cli_state * cli, smbwrp_fileinfo *finfo);
|
---|
131 | int _System smbwrp_getattr(smbwrp_server *srv, cli_state * cli, smbwrp_fileinfo *finfo);
|
---|
132 | int _System smbwrp_fgetattr(cli_state * cli, smbwrp_file *file, smbwrp_fileinfo *finfo);
|
---|
133 | int _System smbwrp_filelist(smbwrp_server *srv, cli_state * cli, filelist_state * state);
|
---|
134 | int _System smbwrp_rename(cli_state * cli, char *oldname, char *newname);
|
---|
135 | int _System smbwrp_chdir(smbwrp_server *srv, cli_state * cli, char *fname);
|
---|
136 | int _System smbwrp_mkdir(cli_state * cli, char *fname);
|
---|
137 | int _System smbwrp_rmdir(cli_state * cli, char *fname);
|
---|
138 | int _System smbwrp_unlink(cli_state * cli, const char *fname);
|
---|
139 | int _System smbwrp_setfilesize(cli_state * cli, smbwrp_file * file, long long newsize);
|
---|
140 | int _System smbwrp_setea(cli_state * cli, char *fname, char * name, unsigned char * value, int size);
|
---|
141 | int _System smbwrp_fsetea(cli_state * cli, smbwrp_file *file, char * name, unsigned char * value, int size);
|
---|
142 | int _System smbwrp_listea(cli_state * cli, char *fname, void * buffer, unsigned long size);
|
---|
143 | int _System smbwrp_flistea(cli_state * cli, smbwrp_file *file, void * buffer, unsigned long size);
|
---|
144 | int _System smbwrp_dskattr(cli_state * cli, FSALLOCATE *pfsa);
|
---|
145 |
|
---|
146 | #endif /* _SMBWRP_H */
|
---|