Merge branch 'v3-3-test' of ssh://git.samba.org/data/git/samba into docbook
[samba.git] / source3 / client / client_proto.h
1 /*
2  * Unix SMB/CIFS implementation.
3  * collected prototypes header
4  *
5  * frozen from "make proto" in May 2008
6  *
7  * Copyright (C) Michael Adam 2008
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, see <http://www.gnu.org/licenses/>.
21  */
22
23 #ifndef _CLIENT_PROTO_H_
24 #define _CLIENT_PROTO_H_
25
26
27 /* The following definitions come from client/client.c  */
28
29 const char *client_get_cur_dir(void);
30 const char *client_set_cur_dir(const char *newdir);
31 void do_list(const char *mask,
32                         uint16 attribute,
33                         void (*fn)(file_info *, const char *dir),
34                         bool rec,
35                         bool dirs);
36 int cmd_iosize(void);
37
38 /* The following definitions come from client/clitar.c  */
39
40 int cmd_block(void);
41 int cmd_tarmode(void);
42 int cmd_setmode(void);
43 int cmd_tar(void);
44 int process_tar(void);
45 int tar_parseargs(int argc, char *argv[], const char *Optarg, int Optind);
46
47 /* The following definitions come from client/dnsbrowse.c  */
48
49 int do_smb_browse(void);
50 int do_smb_browse(void);
51
52 /* The following definitions come from rpc_client/cli_netlogon.c  */
53
54 NTSTATUS rpccli_netlogon_setup_creds(struct rpc_pipe_client *cli,
55                                      const char *server_name,
56                                      const char *domain,
57                                      const char *clnt_name,
58                                      const char *machine_account,
59                                      const unsigned char machine_pwd[16],
60                                      enum netr_SchannelType sec_chan_type,
61                                      uint32_t *neg_flags_inout);
62 NTSTATUS rpccli_netlogon_sam_logon(struct rpc_pipe_client *cli,
63                                    TALLOC_CTX *mem_ctx,
64                                    uint32 logon_parameters,
65                                    const char *domain,
66                                    const char *username,
67                                    const char *password,
68                                    const char *workstation,
69                                    int logon_type);
70 NTSTATUS rpccli_netlogon_sam_network_logon(struct rpc_pipe_client *cli,
71                                            TALLOC_CTX *mem_ctx,
72                                            uint32 logon_parameters,
73                                            const char *server,
74                                            const char *username,
75                                            const char *domain,
76                                            const char *workstation,
77                                            const uint8 chal[8],
78                                            DATA_BLOB lm_response,
79                                            DATA_BLOB nt_response,
80                                            struct netr_SamInfo3 **info3);
81 NTSTATUS rpccli_netlogon_sam_network_logon_ex(struct rpc_pipe_client *cli,
82                                               TALLOC_CTX *mem_ctx,
83                                               uint32 logon_parameters,
84                                               const char *server,
85                                               const char *username,
86                                               const char *domain,
87                                               const char *workstation,
88                                               const uint8 chal[8],
89                                               DATA_BLOB lm_response,
90                                               DATA_BLOB nt_response,
91                                               struct netr_SamInfo3 **info3);
92
93 /* The following definitions come from rpc_client/cli_pipe.c  */
94
95 NTSTATUS rpc_api_pipe_req(struct rpc_pipe_client *cli,
96                         uint8 op_num,
97                         prs_struct *in_data,
98                         prs_struct *out_data);
99 NTSTATUS rpc_pipe_bind(struct rpc_pipe_client *cli,
100                        struct cli_pipe_auth_data *auth);
101 unsigned int rpccli_set_timeout(struct rpc_pipe_client *cli,
102                                 unsigned int timeout);
103 bool rpccli_is_pipe_idx(struct rpc_pipe_client *cli, int pipe_idx);
104 bool rpccli_get_pwd_hash(struct rpc_pipe_client *cli, uint8_t nt_hash[16]);
105 struct cli_state *rpc_pipe_np_smb_conn(struct rpc_pipe_client *p);
106 NTSTATUS rpccli_anon_bind_data(TALLOC_CTX *mem_ctx,
107                                struct cli_pipe_auth_data **presult);
108 NTSTATUS rpccli_ntlmssp_bind_data(TALLOC_CTX *mem_ctx,
109                                   enum pipe_auth_type auth_type,
110                                   enum pipe_auth_level auth_level,
111                                   const char *domain,
112                                   const char *username,
113                                   const char *password,
114                                   struct cli_pipe_auth_data **presult);
115 NTSTATUS rpccli_schannel_bind_data(TALLOC_CTX *mem_ctx, const char *domain,
116                                    enum pipe_auth_level auth_level,
117                                    const struct dcinfo *pdc,
118                                    struct cli_pipe_auth_data **presult);
119 NTSTATUS rpccli_kerberos_bind_data(TALLOC_CTX *mem_ctx,
120                                    enum pipe_auth_level auth_level,
121                                    const char *service_princ,
122                                    const char *username,
123                                    const char *password,
124                                    struct cli_pipe_auth_data **presult);
125 NTSTATUS rpc_pipe_open_tcp(TALLOC_CTX *mem_ctx, const char *host,
126                            uint16_t port,
127                            const struct ndr_syntax_id *abstract_syntax,
128                            struct rpc_pipe_client **presult);
129 struct rpc_pipe_client *cli_rpc_pipe_open_noauth(struct cli_state *cli, int pipe_idx, NTSTATUS *perr);
130 struct rpc_pipe_client *cli_rpc_pipe_open_ntlmssp(struct cli_state *cli,
131                                                 int pipe_idx,
132                                                 enum pipe_auth_level auth_level,
133                                                 const char *domain,
134                                                 const char *username,
135                                                 const char *password,
136                                                 NTSTATUS *perr);
137 struct rpc_pipe_client *cli_rpc_pipe_open_spnego_ntlmssp(struct cli_state *cli,
138                                                 int pipe_idx,
139                                                 enum pipe_auth_level auth_level,
140                                                 const char *domain,
141                                                 const char *username,
142                                                 const char *password,
143                                                 NTSTATUS *perr);
144 struct rpc_pipe_client *get_schannel_session_key(struct cli_state *cli,
145                                                         const char *domain,
146                                                         uint32 *pneg_flags,
147                                                         NTSTATUS *perr);
148 struct rpc_pipe_client *cli_rpc_pipe_open_schannel_with_key(struct cli_state *cli,
149                                         int pipe_idx,
150                                         enum pipe_auth_level auth_level,
151                                         const char *domain,
152                                         const struct dcinfo *pdc,
153                                         NTSTATUS *perr);
154 struct rpc_pipe_client *cli_rpc_pipe_open_ntlmssp_auth_schannel(struct cli_state *cli,
155                                                 int pipe_idx,
156                                                 enum pipe_auth_level auth_level,
157                                                 const char *domain,
158                                                 const char *username,
159                                                 const char *password,
160                                                 NTSTATUS *perr);
161 struct rpc_pipe_client *cli_rpc_pipe_open_schannel(struct cli_state *cli,
162                                                 int pipe_idx,
163                                                 enum pipe_auth_level auth_level,
164                                                 const char *domain,
165                                                 NTSTATUS *perr);
166 struct rpc_pipe_client *cli_rpc_pipe_open_krb5(struct cli_state *cli,
167                                                 int pipe_idx,
168                                                 enum pipe_auth_level auth_level,
169                                                 const char *service_princ,
170                                                 const char *username,
171                                                 const char *password,
172                                                 NTSTATUS *perr);
173
174 /* The following definitions come from rpc_client/init_lsa.c  */
175
176 void init_lsa_String(struct lsa_String *name, const char *s);
177 void init_lsa_StringLarge(struct lsa_StringLarge *name, const char *s);
178 void init_lsa_AsciiString(struct lsa_AsciiString *name, const char *s);
179 void init_lsa_AsciiStringLarge(struct lsa_AsciiStringLarge *name, const char *s);
180 void init_lsa_sec_qos(struct lsa_QosInfo *r,
181                       uint32_t len,
182                       uint16_t impersonation_level,
183                       uint8_t context_mode,
184                       uint8_t effective_only);
185 void init_lsa_obj_attr(struct lsa_ObjectAttribute *r,
186                        uint32_t len,
187                        uint8_t *root_dir,
188                        const char *object_name,
189                        uint32_t attributes,
190                        struct security_descriptor *sec_desc,
191                        struct lsa_QosInfo *sec_qos);
192 void init_lsa_translated_sid(struct lsa_TranslatedSid *r,
193                              enum lsa_SidType sid_type,
194                              uint32_t rid,
195                              uint32_t sid_index);
196 void init_lsa_translated_name2(struct lsa_TranslatedName2 *r,
197                                enum lsa_SidType sid_type,
198                                const char *name,
199                                uint32_t sid_index,
200                                uint32_t unknown);
201
202 /* The following definitions come from rpc_client/init_netlogon.c  */
203
204 void init_netr_SamBaseInfo(struct netr_SamBaseInfo *r,
205                            NTTIME last_logon,
206                            NTTIME last_logoff,
207                            NTTIME acct_expiry,
208                            NTTIME last_password_change,
209                            NTTIME allow_password_change,
210                            NTTIME force_password_change,
211                            const char *account_name,
212                            const char *full_name,
213                            const char *logon_script,
214                            const char *profile_path,
215                            const char *home_directory,
216                            const char *home_drive,
217                            uint16_t logon_count,
218                            uint16_t bad_password_count,
219                            uint32_t rid,
220                            uint32_t primary_gid,
221                            struct samr_RidWithAttributeArray groups,
222                            uint32_t user_flags,
223                            struct netr_UserSessionKey key,
224                            const char *logon_server,
225                            const char *domain,
226                            struct dom_sid2 *domain_sid,
227                            struct netr_LMSessionKey LMSessKey,
228                            uint32_t acct_flags);
229 void init_netr_SamInfo3(struct netr_SamInfo3 *r,
230                         NTTIME last_logon,
231                         NTTIME last_logoff,
232                         NTTIME acct_expiry,
233                         NTTIME last_password_change,
234                         NTTIME allow_password_change,
235                         NTTIME force_password_change,
236                         const char *account_name,
237                         const char *full_name,
238                         const char *logon_script,
239                         const char *profile_path,
240                         const char *home_directory,
241                         const char *home_drive,
242                         uint16_t logon_count,
243                         uint16_t bad_password_count,
244                         uint32_t rid,
245                         uint32_t primary_gid,
246                         struct samr_RidWithAttributeArray groups,
247                         uint32_t user_flags,
248                         struct netr_UserSessionKey key,
249                         const char *logon_server,
250                         const char *domain,
251                         struct dom_sid2 *domain_sid,
252                         struct netr_LMSessionKey LMSessKey,
253                         uint32_t acct_flags,
254                         uint32_t sidcount,
255                         struct netr_SidAttr *sids);
256 NTSTATUS serverinfo_to_SamInfo3(struct auth_serversupplied_info *server_info,
257                                 uint8_t pipe_session_key[16],
258                                 struct netr_SamInfo3 *sam3);
259 void init_netr_IdentityInfo(struct netr_IdentityInfo *r,
260                             const char *domain_name,
261                             uint32_t parameter_control,
262                             uint32_t logon_id_low,
263                             uint32_t logon_id_high,
264                             const char *account_name,
265                             const char *workstation);
266 void init_netr_NetworkInfo(struct netr_NetworkInfo *r,
267                            const char *domain_name,
268                            uint32_t parameter_control,
269                            uint32_t logon_id_low,
270                            uint32_t logon_id_high,
271                            const char *account_name,
272                            const char *workstation,
273                            uint8_t challenge[8],
274                            struct netr_ChallengeResponse nt,
275                            struct netr_ChallengeResponse lm);
276 void init_netr_PasswordInfo(struct netr_PasswordInfo *r,
277                             const char *domain_name,
278                             uint32_t parameter_control,
279                             uint32_t logon_id_low,
280                             uint32_t logon_id_high,
281                             const char *account_name,
282                             const char *workstation,
283                             struct samr_Password lmpassword,
284                             struct samr_Password ntpassword);
285
286 /* The following definitions come from rpc_client/init_srvsvc.c  */
287
288 void init_srvsvc_NetSrvInfo102(struct srvsvc_NetSrvInfo102 *r,
289                                enum srvsvc_PlatformId platform_id,
290                                const char *server_name,
291                                uint32_t version_major,
292                                uint32_t version_minor,
293                                uint32_t server_type,
294                                const char *comment,
295                                uint32_t users,
296                                uint32_t disc,
297                                uint32_t hidden,
298                                uint32_t announce,
299                                uint32_t anndelta,
300                                uint32_t licenses,
301                                const char *userpath);
302 void init_srvsvc_NetSrvInfo101(struct srvsvc_NetSrvInfo101 *r,
303                                enum srvsvc_PlatformId platform_id,
304                                const char *server_name,
305                                uint32_t version_major,
306                                uint32_t version_minor,
307                                uint32_t server_type,
308                                const char *comment);
309 void init_srvsvc_NetSrvInfo100(struct srvsvc_NetSrvInfo100 *r,
310                                enum srvsvc_PlatformId platform_id,
311                                const char *server_name);
312 void init_srvsvc_NetShareInfo0(struct srvsvc_NetShareInfo0 *r,
313                                const char *name);
314 void init_srvsvc_NetShareInfo1(struct srvsvc_NetShareInfo1 *r,
315                                const char *name,
316                                enum srvsvc_ShareType type,
317                                const char *comment);
318 void init_srvsvc_NetShareInfo2(struct srvsvc_NetShareInfo2 *r,
319                                const char *name,
320                                enum srvsvc_ShareType type,
321                                const char *comment,
322                                uint32_t permissions,
323                                uint32_t max_users,
324                                uint32_t current_users,
325                                const char *path,
326                                const char *password);
327 void init_srvsvc_NetShareInfo501(struct srvsvc_NetShareInfo501 *r,
328                                  const char *name,
329                                  enum srvsvc_ShareType type,
330                                  const char *comment,
331                                  uint32_t csc_policy);
332 void init_srvsvc_NetShareInfo502(struct srvsvc_NetShareInfo502 *r,
333                                  const char *name,
334                                  enum srvsvc_ShareType type,
335                                  const char *comment,
336                                  uint32_t permissions,
337                                  uint32_t max_users,
338                                  uint32_t current_users,
339                                  const char *path,
340                                  const char *password,
341                                  struct sec_desc_buf *sd_buf);
342 void init_srvsvc_NetShareInfo1004(struct srvsvc_NetShareInfo1004 *r,
343                                   const char *comment);
344 void init_srvsvc_NetShareInfo1005(struct srvsvc_NetShareInfo1005 *r,
345                                   uint32_t dfs_flags);
346 void init_srvsvc_NetShareInfo1006(struct srvsvc_NetShareInfo1006 *r,
347                                   uint32_t max_users);
348 void init_srvsvc_NetShareInfo1007(struct srvsvc_NetShareInfo1007 *r,
349                                   uint32_t flags,
350                                   const char *alternate_directory_name);
351 void init_srvsvc_NetRemoteTODInfo(struct srvsvc_NetRemoteTODInfo *r,
352                                   uint32_t elapsed,
353                                   uint32_t msecs,
354                                   uint32_t hours,
355                                   uint32_t mins,
356                                   uint32_t secs,
357                                   uint32_t hunds,
358                                   int32_t ttimezone,
359                                   uint32_t tinterval,
360                                   uint32_t day,
361                                   uint32_t month,
362                                   uint32_t year,
363                                   uint32_t weekday);
364 void init_srvsvc_NetSessInfo0(struct srvsvc_NetSessInfo0 *r,
365                               const char *client);
366 void init_srvsvc_NetSessInfo1(struct srvsvc_NetSessInfo1 *r,
367                               const char *client,
368                               const char *user,
369                               uint32_t num_open,
370                               uint32_t _time,
371                               uint32_t idle_time,
372                               uint32_t user_flags);
373 void init_srvsvc_NetSessInfo2(struct srvsvc_NetSessInfo2 *r,
374                               const char *client,
375                               const char *user,
376                               uint32_t num_open,
377                               uint32_t _time,
378                               uint32_t idle_time,
379                               uint32_t user_flags,
380                               const char *client_type);
381 void init_srvsvc_NetSessInfo10(struct srvsvc_NetSessInfo10 *r,
382                                const char *client,
383                                const char *user,
384                                uint32_t _time,
385                                uint32_t idle_time);
386 void init_srvsvc_NetSessInfo502(struct srvsvc_NetSessInfo502 *r,
387                                const char *client,
388                                const char *user,
389                                uint32_t num_open,
390                                uint32_t _time,
391                                uint32_t idle_time,
392                                uint32_t user_flags,
393                                const char *client_type,
394                                const char *transport);
395 void init_srvsvc_NetFileInfo2(struct srvsvc_NetFileInfo2 *r,
396                               uint32_t fid);
397 void init_srvsvc_NetFileInfo3(struct srvsvc_NetFileInfo3 *r,
398                               uint32_t fid,
399                               uint32_t permissions,
400                               uint32_t num_locks,
401                               const char *path,
402                               const char *user);
403 void init_srvsvc_NetConnInfo0(struct srvsvc_NetConnInfo0 *r,
404                               uint32_t conn_id);
405 void init_srvsvc_NetConnInfo1(struct srvsvc_NetConnInfo1 *r,
406                               uint32_t conn_id,
407                               uint32_t conn_type,
408                               uint32_t num_open,
409                               uint32_t num_users,
410                               uint32_t conn_time,
411                               const char *user,
412                               const char *share);
413
414 /* The following definitions come from rpc_parse/parse_rpc.c  */
415
416 const char *cli_get_pipe_name(int pipe_idx);
417 int cli_get_pipe_idx(const RPC_IFACE *syntax);
418 void init_rpc_hdr(RPC_HDR *hdr, enum RPC_PKT_TYPE pkt_type, uint8 flags,
419                                 uint32 call_id, int data_len, int auth_len);
420 bool smb_io_rpc_hdr(const char *desc,  RPC_HDR *rpc, prs_struct *ps, int depth);
421 void init_rpc_context(RPC_CONTEXT *rpc_ctx, uint16 context_id,
422                       const RPC_IFACE *abstract, const RPC_IFACE *transfer);
423 void init_rpc_hdr_rb(RPC_HDR_RB *rpc, 
424                                 uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid,
425                                 RPC_CONTEXT *context);
426 bool smb_io_rpc_context(const char *desc, RPC_CONTEXT *rpc_ctx, prs_struct *ps, int depth);
427 bool smb_io_rpc_hdr_rb(const char *desc, RPC_HDR_RB *rpc, prs_struct *ps, int depth);
428 void init_rpc_hdr_ba(RPC_HDR_BA *rpc, 
429                                 uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid,
430                                 const char *pipe_addr,
431                                 uint8 num_results, uint16 result, uint16 reason,
432                                 RPC_IFACE *transfer);
433 bool smb_io_rpc_hdr_ba(const char *desc, RPC_HDR_BA *rpc, prs_struct *ps, int depth);
434 void init_rpc_hdr_req(RPC_HDR_REQ *hdr, uint32 alloc_hint, uint16 opnum);
435 bool smb_io_rpc_hdr_req(const char *desc, RPC_HDR_REQ *rpc, prs_struct *ps, int depth);
436 bool smb_io_rpc_hdr_resp(const char *desc, RPC_HDR_RESP *rpc, prs_struct *ps, int depth);
437 bool smb_io_rpc_hdr_fault(const char *desc, RPC_HDR_FAULT *rpc, prs_struct *ps, int depth);
438 void init_rpc_hdr_auth(RPC_HDR_AUTH *rai,
439                                 uint8 auth_type, uint8 auth_level,
440                                 uint8 auth_pad_len,
441                                 uint32 auth_context_id);
442 bool smb_io_rpc_hdr_auth(const char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, int depth);
443 bool rpc_auth_verifier_chk(RPC_AUTH_VERIFIER *rav,
444                                 const char *signature, uint32 msg_type);
445 void init_rpc_auth_verifier(RPC_AUTH_VERIFIER *rav,
446                                 const char *signature, uint32 msg_type);
447 bool smb_io_rpc_auth_verifier(const char *desc, RPC_AUTH_VERIFIER *rav, prs_struct *ps, int depth);
448 bool smb_io_rpc_schannel_verifier(const char *desc, RPC_AUTH_VERIFIER *rav, prs_struct *ps, int depth);
449 void init_rpc_auth_schannel_neg(RPC_AUTH_SCHANNEL_NEG *neg,
450                               const char *domain, const char *myname);
451 bool smb_io_rpc_auth_schannel_neg(const char *desc, RPC_AUTH_SCHANNEL_NEG *neg,
452                                 prs_struct *ps, int depth);
453 bool smb_io_rpc_auth_schannel_chk(const char *desc, int auth_len, 
454                                 RPC_AUTH_SCHANNEL_CHK * chk,
455                                 prs_struct *ps, int depth);
456
457 #endif /*  _CLIENT_PROTO_H_  */