s3-libsmb: only include rap client when needed.
[bbaumbach/samba-autobuild/.git] / source3 / libsmb / clirap.h
1 /*
2    Samba Unix/Linux SMB client library
3    More client RAP (SMB Remote Procedure Calls) functions
4    Copyright (C) 2001 Steve French (sfrench@us.ibm.com)
5    Copyright (C) 2001 Jim McDonough (jmcd@us.ibm.com)
6    Copyright (C) 2007 Jeremy Allison. jra@samba.org
7    Copyright (C) Andrew Tridgell         1994-1998
8    Copyright (C) Gerald (Jerry) Carter   2004
9    Copyright (C) James Peach             2007
10
11    This program is free software; you can redistribute it and/or modify
12    it under the terms of the GNU General Public License as published by
13    the Free Software Foundation; either version 3 of the License, or
14    (at your option) any later version.
15
16    This program is distributed in the hope that it will be useful,
17    but WITHOUT ANY WARRANTY; without even the implied warranty of
18    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19    GNU General Public License for more details.
20
21    You should have received a copy of the GNU General Public License
22    along with this program.  If not, see <http://www.gnu.org/licenses/>.
23 */
24
25 #ifndef _LIBSMB_CLIRAP_H
26 #define _LIBSMB_CLIRAP_H
27
28 /* The following definitions come from libsmb/clirap.c  */
29
30 bool cli_api(struct cli_state *cli,
31              char *param, int prcnt, int mprcnt,
32              char *data, int drcnt, int mdrcnt,
33              char **rparam, unsigned int *rprcnt,
34              char **rdata, unsigned int *rdrcnt);
35 bool cli_NetWkstaUserLogon(struct cli_state *cli,char *user, char *workstation);
36 int cli_RNetShareEnum(struct cli_state *cli, void (*fn)(const char *, uint32, const char *, void *), void *state);
37 bool cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype,
38                        void (*fn)(const char *, uint32, const char *, void *),
39                        void *state);
40 bool cli_oem_change_password(struct cli_state *cli, const char *user, const char *new_password,
41                              const char *old_password);
42 struct tevent_req *cli_qpathinfo1_send(TALLOC_CTX *mem_ctx,
43                                        struct event_context *ev,
44                                        struct cli_state *cli,
45                                        const char *fname);
46 NTSTATUS cli_qpathinfo1_recv(struct tevent_req *req,
47                              time_t *change_time,
48                              time_t *access_time,
49                              time_t *write_time,
50                              SMB_OFF_T *size,
51                              uint16 *mode);
52 NTSTATUS cli_qpathinfo1(struct cli_state *cli,
53                         const char *fname,
54                         time_t *change_time,
55                         time_t *access_time,
56                         time_t *write_time,
57                         SMB_OFF_T *size,
58                         uint16 *mode);
59 NTSTATUS cli_setpathinfo_basic(struct cli_state *cli, const char *fname,
60                                time_t create_time,
61                                time_t access_time,
62                                time_t write_time,
63                                time_t change_time,
64                                uint16 mode);
65 struct tevent_req *cli_qpathinfo2_send(TALLOC_CTX *mem_ctx,
66                                        struct event_context *ev,
67                                        struct cli_state *cli,
68                                        const char *fname);
69 NTSTATUS cli_qpathinfo2_recv(struct tevent_req *req,
70                              struct timespec *create_time,
71                              struct timespec *access_time,
72                              struct timespec *write_time,
73                              struct timespec *change_time,
74                              SMB_OFF_T *size, uint16 *mode,
75                              SMB_INO_T *ino);
76 NTSTATUS cli_qpathinfo2(struct cli_state *cli, const char *fname,
77                         struct timespec *create_time,
78                         struct timespec *access_time,
79                         struct timespec *write_time,
80                         struct timespec *change_time,
81                         SMB_OFF_T *size, uint16 *mode,
82                         SMB_INO_T *ino);
83 struct tevent_req *cli_qpathinfo_streams_send(TALLOC_CTX *mem_ctx,
84                                               struct tevent_context *ev,
85                                               struct cli_state *cli,
86                                               const char *fname);
87 NTSTATUS cli_qpathinfo_streams_recv(struct tevent_req *req,
88                                     TALLOC_CTX *mem_ctx,
89                                     unsigned int *pnum_streams,
90                                     struct stream_struct **pstreams);
91 NTSTATUS cli_qpathinfo_streams(struct cli_state *cli, const char *fname,
92                                TALLOC_CTX *mem_ctx,
93                                unsigned int *pnum_streams,
94                                struct stream_struct **pstreams);
95 NTSTATUS cli_qfilename(struct cli_state *cli, uint16_t fnum, char *name,
96                        size_t namelen);
97 NTSTATUS cli_qfileinfo_basic(struct cli_state *cli, uint16_t fnum,
98                              uint16 *mode, SMB_OFF_T *size,
99                              struct timespec *create_time,
100                              struct timespec *access_time,
101                              struct timespec *write_time,
102                              struct timespec *change_time,
103                              SMB_INO_T *ino);
104 struct tevent_req *cli_qpathinfo_basic_send(TALLOC_CTX *mem_ctx,
105                                             struct event_context *ev,
106                                             struct cli_state *cli,
107                                             const char *fname);
108 NTSTATUS cli_qpathinfo_basic_recv(struct tevent_req *req,
109                                   SMB_STRUCT_STAT *sbuf, uint32 *attributes);
110 NTSTATUS cli_qpathinfo_basic(struct cli_state *cli, const char *name,
111                              SMB_STRUCT_STAT *sbuf, uint32 *attributes);
112 NTSTATUS cli_qpathinfo_alt_name(struct cli_state *cli, const char *fname, fstring alt_name);
113 struct tevent_req *cli_qpathinfo_send(TALLOC_CTX *mem_ctx,
114                                       struct tevent_context *ev,
115                                       struct cli_state *cli, const char *fname,
116                                       uint16_t level, uint32_t min_rdata,
117                                       uint32_t max_rdata);
118 NTSTATUS cli_qpathinfo_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
119                             uint8_t **rdata, uint32_t *num_rdata);
120 NTSTATUS cli_qpathinfo(TALLOC_CTX *mem_ctx, struct cli_state *cli,
121                        const char *fname, uint16_t level, uint32_t min_rdata,
122                        uint32_t max_rdata,
123                        uint8_t **rdata, uint32_t *num_rdata);
124
125 struct tevent_req *cli_qfileinfo_send(TALLOC_CTX *mem_ctx,
126                                       struct tevent_context *ev,
127                                       struct cli_state *cli, uint16_t fnum,
128                                       uint16_t level, uint32_t min_rdata,
129                                       uint32_t max_rdata);
130 NTSTATUS cli_qfileinfo_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
131                             uint8_t **rdata, uint32_t *num_rdata);
132 NTSTATUS cli_qfileinfo(TALLOC_CTX *mem_ctx, struct cli_state *cli,
133                        uint16_t fnum, uint16_t level, uint32_t min_rdata,
134                        uint32_t max_rdata,
135                        uint8_t **rdata, uint32_t *num_rdata);
136
137 struct tevent_req *cli_flush_send(TALLOC_CTX *mem_ctx,
138                                   struct event_context *ev,
139                                   struct cli_state *cli,
140                                   uint16_t fnum);
141 NTSTATUS cli_flush_recv(struct tevent_req *req);
142 NTSTATUS cli_flush(TALLOC_CTX *mem_ctx, struct cli_state *cli, uint16_t fnum);
143
144 struct tevent_req *cli_shadow_copy_data_send(TALLOC_CTX *mem_ctx,
145                                              struct tevent_context *ev,
146                                              struct cli_state *cli,
147                                              uint16_t fnum,
148                                              bool get_names);
149 NTSTATUS cli_shadow_copy_data_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
150                                    char ***pnames, int *pnum_names);
151 NTSTATUS cli_shadow_copy_data(TALLOC_CTX *mem_ctx, struct cli_state *cli,
152                               uint16_t fnum, bool get_names,
153                               char ***pnames, int *pnum_names);
154
155 /* The following definitions come from libsmb/clirap2.c  */
156 struct rap_group_info_1;
157 struct rap_user_info_1;
158 struct rap_share_info_2;
159
160 int cli_NetGroupDelete(struct cli_state *cli, const char *group_name);
161 int cli_NetGroupAdd(struct cli_state *cli, struct rap_group_info_1 *grinfo);
162 int cli_RNetGroupEnum(struct cli_state *cli, void (*fn)(const char *, const char *, void *), void *state);
163 int cli_RNetGroupEnum0(struct cli_state *cli,
164                        void (*fn)(const char *, void *),
165                        void *state);
166 int cli_NetGroupDelUser(struct cli_state * cli, const char *group_name, const char *user_name);
167 int cli_NetGroupAddUser(struct cli_state * cli, const char *group_name, const char *user_name);
168 int cli_NetGroupGetUsers(struct cli_state * cli, const char *group_name, void (*fn)(const char *, void *), void *state );
169 int cli_NetUserGetGroups(struct cli_state * cli, const char *user_name, void (*fn)(const char *, void *), void *state );
170 int cli_NetUserDelete(struct cli_state *cli, const char * user_name );
171 int cli_NetUserAdd(struct cli_state *cli, struct rap_user_info_1 * userinfo );
172 int cli_RNetUserEnum(struct cli_state *cli, void (*fn)(const char *, const char *, const char *, const char *, void *), void *state);
173 int cli_RNetUserEnum0(struct cli_state *cli,
174                       void (*fn)(const char *, void *),
175                       void *state);
176 int cli_NetFileClose(struct cli_state *cli, uint32 file_id );
177 int cli_NetFileGetInfo(struct cli_state *cli, uint32 file_id, void (*fn)(const char *, const char *, uint16, uint16, uint32));
178 int cli_NetFileEnum(struct cli_state *cli, const char * user,
179                     const char * base_path,
180                     void (*fn)(const char *, const char *, uint16, uint16,
181                                uint32));
182 int cli_NetShareAdd(struct cli_state *cli, struct rap_share_info_2 * sinfo );
183 int cli_NetShareDelete(struct cli_state *cli, const char * share_name );
184 bool cli_get_pdc_name(struct cli_state *cli, const char *workgroup, char **pdc_name);
185 bool cli_get_server_domain(struct cli_state *cli);
186 bool cli_get_server_type(struct cli_state *cli, uint32 *pstype);
187 bool cli_get_server_name(TALLOC_CTX *mem_ctx, struct cli_state *cli,
188                          char **servername);
189 bool cli_ns_check_server_type(struct cli_state *cli, char *workgroup, uint32 stype);
190 bool cli_NetWkstaUserLogoff(struct cli_state *cli, const char *user, const char *workstation);
191 int cli_NetPrintQEnum(struct cli_state *cli,
192                 void (*qfn)(const char*,uint16,uint16,uint16,const char*,const char*,const char*,const char*,const char*,uint16,uint16),
193                 void (*jfn)(uint16,const char*,const char*,const char*,const char*,uint16,uint16,const char*,unsigned int,unsigned int,const char*));
194 int cli_NetPrintQGetInfo(struct cli_state *cli, const char *printer,
195         void (*qfn)(const char*,uint16,uint16,uint16,const char*,const char*,const char*,const char*,const char*,uint16,uint16),
196         void (*jfn)(uint16,const char*,const char*,const char*,const char*,uint16,uint16,const char*,unsigned int,unsigned int,const char*));
197 int cli_RNetServiceEnum(struct cli_state *cli, void (*fn)(const char *, const char *, void *), void *state);
198 int cli_NetSessionEnum(struct cli_state *cli, void (*fn)(char *, char *, uint16, uint16, uint16, unsigned int, unsigned int, unsigned int, char *));
199 int cli_NetSessionGetInfo(struct cli_state *cli, const char *workstation,
200                 void (*fn)(const char *, const char *, uint16, uint16, uint16, unsigned int, unsigned int, unsigned int, const char *));
201 int cli_NetSessionDel(struct cli_state *cli, const char *workstation);
202 int cli_NetConnectionEnum(struct cli_state *cli, const char *qualifier,
203                         void (*fn)(uint16_t conid, uint16_t contype,
204                                 uint16_t numopens, uint16_t numusers,
205                                 uint32_t contime, const char *username,
206                                 const char *netname));
207
208 #endif /* _LIBSMB_CLIRAP_H */