net: freeze net_proto.h from "make proto"
[ab/samba.git/.git] / source3 / utils / net_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 _NET_PROTO_H_
24 #define _NET_PROTO_H_
25
26
27 /* The following definitions come from auth/token_util.c  */
28
29 bool nt_token_check_sid ( const DOM_SID *sid, const NT_USER_TOKEN *token );
30 bool nt_token_check_domain_rid( NT_USER_TOKEN *token, uint32 rid );
31 NT_USER_TOKEN *get_root_nt_token( void );
32 NTSTATUS add_aliases(const DOM_SID *domain_sid,
33                      struct nt_user_token *token);
34 struct nt_user_token *create_local_nt_token(TALLOC_CTX *mem_ctx,
35                                             const DOM_SID *user_sid,
36                                             bool is_guest,
37                                             int num_groupsids,
38                                             const DOM_SID *groupsids);
39 void debug_nt_user_token(int dbg_class, int dbg_lev, NT_USER_TOKEN *token);
40 void debug_unix_user_token(int dbg_class, int dbg_lev, uid_t uid, gid_t gid,
41                            int n_groups, gid_t *groups);
42
43 /* The following definitions come from utils/net.c  */
44
45 uint32 get_sec_channel_type(const char *param);
46 int net_run_function(struct net_context *c, int argc, const char **argv,
47                      struct functable *table,
48                      int (*usage_fn)(struct net_context *c,
49                                      int argc, const char **argv));
50 int net_run_function2(struct net_context *c, int argc, const char **argv,
51                       const char *whoami, struct functable2 *table);
52 NTSTATUS connect_to_service(struct net_context *c,
53                                         struct cli_state **cli_ctx,
54                                         struct sockaddr_storage *server_ss,
55                                         const char *server_name,
56                                         const char *service_name,
57                                         const char *service_type);
58 NTSTATUS connect_to_ipc(struct net_context *c,
59                         struct cli_state **cli_ctx,
60                         struct sockaddr_storage *server_ss,
61                         const char *server_name);
62 NTSTATUS connect_to_ipc_anonymous(struct net_context *c,
63                                 struct cli_state **cli_ctx,
64                                 struct sockaddr_storage *server_ss,
65                                 const char *server_name);
66 NTSTATUS connect_to_ipc_krb5(struct net_context *c,
67                         struct cli_state **cli_ctx,
68                         struct sockaddr_storage *server_ss,
69                         const char *server_name);
70 NTSTATUS connect_dst_pipe(struct net_context *c, struct cli_state **cli_dst,
71                           struct rpc_pipe_client **pp_pipe_hnd, int pipe_num);
72 int net_use_krb_machine_account(struct net_context *c);
73 int net_use_machine_account(struct net_context *c);
74 bool net_find_server(struct net_context *c,
75                         const char *domain,
76                         unsigned flags,
77                         struct sockaddr_storage *server_ss,
78                         char **server_name);
79 bool net_find_pdc(struct sockaddr_storage *server_ss,
80                 fstring server_name,
81                 const char *domain_name);
82 NTSTATUS net_make_ipc_connection(struct net_context *c, unsigned flags,
83                                  struct cli_state **pcli);
84 NTSTATUS net_make_ipc_connection_ex(struct net_context *c ,const char *domain,
85                                     const char *server,
86                                     struct sockaddr_storage *pss,
87                                     unsigned flags, struct cli_state **pcli);
88 int net_help_afs(struct net_context *c, int argc, const char **argv);
89 const char *net_prompt_pass(struct net_context *c, const char *user);
90
91 /* The following definitions come from utils/net_ads.c  */
92
93 int net_ads_usage(struct net_context *c, int argc, const char **argv);
94 ADS_STATUS ads_startup(struct net_context *c, bool only_own_domain, ADS_STRUCT **ads);
95 ADS_STATUS ads_startup_nobind(struct net_context *c, bool only_own_domain, ADS_STRUCT **ads);
96 int net_ads_check_our_domain(struct net_context *c);
97 int net_ads_check(struct net_context *c);
98 int net_ads_user(struct net_context *c, int argc, const char **argv);
99 int net_ads_group(struct net_context *c, int argc, const char **argv);
100 int net_ads_testjoin(struct net_context *c, int argc, const char **argv);
101 int net_ads_join(struct net_context *c, int argc, const char **argv);
102 int net_ads_printer_usage(struct net_context *c, int argc, const char **argv);
103 int net_ads_changetrustpw(struct net_context *c, int argc, const char **argv);
104 int net_ads_keytab(struct net_context *c, int argc, const char **argv);
105 int net_ads_kerberos(struct net_context *c, int argc, const char **argv);
106 int net_ads_help(struct net_context *c, int argc, const char **argv);
107 int net_ads(struct net_context *c, int argc, const char **argv);
108 int net_ads_keytab(struct net_context *c, int argc, const char **argv);
109 int net_ads_kerberos(struct net_context *c, int argc, const char **argv);
110 int net_ads_usage(struct net_context *c, int argc, const char **argv);
111 int net_ads_help(struct net_context *c, int argc, const char **argv);
112 int net_ads_changetrustpw(struct net_context *c, int argc, const char **argv);
113 int net_ads_join(struct net_context *c, int argc, const char **argv);
114 int net_ads_user(struct net_context *c, int argc, const char **argv);
115 int net_ads_group(struct net_context *c, int argc, const char **argv);
116 int net_ads_check(struct net_context *c);
117 int net_ads_check_our_domain(struct net_context *c);
118 int net_ads(struct net_context *c, int argc, const char **argv);
119
120 /* The following definitions come from utils/net_ads_gpo.c  */
121
122 int net_ads_gpo(struct net_context *c, int argc, const char **argv);
123
124 /* The following definitions come from utils/net_cache.c  */
125
126 int net_cache(struct net_context *c, int argc, const char **argv);
127
128 /* The following definitions come from utils/net_conf.c  */
129
130 int net_conf(struct net_context *c, int argc, const char **argv);
131
132 /* The following definitions come from utils/net_dns.c  */
133
134 int get_my_ip_address( struct sockaddr_storage **pp_ss );
135
136 /* The following definitions come from utils/net_dom.c  */
137
138 int net_help_dom(struct net_context *c, int argc, const char **argv);
139 int net_dom(struct net_context *c, int argc, const char **argv);
140
141 /* The following definitions come from utils/net_groupmap.c  */
142
143 int net_help_groupmap(struct net_context *c, int argc, const char **argv);
144 int net_groupmap(struct net_context *c, int argc, const char **argv);
145
146 /* The following definitions come from utils/net_help.c  */
147
148 int net_common_methods_usage(struct net_context *c, int argc, const char**argv);
149 int net_common_flags_usage(struct net_context *c, int argc, const char **argv);
150 int net_help_user(struct net_context *c, int argc, const char **argv);
151 int net_help_group(struct net_context *c, int argc, const char **argv);
152 int net_help_join(struct net_context *c, int argc, const char **argv);
153 int net_help_share(struct net_context *c, int argc, const char **argv);
154 int net_help_file(struct net_context *c, int argc, const char **argv);
155 int net_help_printer(struct net_context *c, int argc, const char **argv);
156 int net_help_status(struct net_context *c, int argc, const char **argv);
157 int net_help(struct net_context *c, int argc, const char **argv);
158
159 /* The following definitions come from utils/net_idmap.c  */
160
161 bool idmap_store_secret(const char *backend, bool alloc,
162                         const char *domain, const char *identity,
163                         const char *secret);
164 int net_help_idmap(struct net_context *c, int argc, const char **argv);
165 int net_idmap(struct net_context *c, int argc, const char **argv);
166
167 /* The following definitions come from utils/net_lookup.c  */
168
169 int net_lookup_usage(struct net_context *c, int argc, const char **argv);
170 int net_lookup(struct net_context *c, int argc, const char **argv);
171
172 /* The following definitions come from utils/net_rap.c  */
173
174 int net_rap_file_usage(struct net_context *c, int argc, const char **argv);
175 int net_rap_file(struct net_context *c, int argc, const char **argv);
176 int net_rap_share_usage(struct net_context *c, int argc, const char **argv);
177 int net_rap_share(struct net_context *c, int argc, const char **argv);
178 int net_rap_session_usage(struct net_context *c, int argc, const char **argv);
179 int net_rap_session(struct net_context *c, int argc, const char **argv);
180 int net_rap_server_usage(struct net_context *c, int argc, const char **argv);
181 int net_rap_server(struct net_context *c, int argc, const char **argv);
182 int net_rap_domain_usage(struct net_context *c, int argc, const char **argv);
183 int net_rap_domain(struct net_context *c, int argc, const char **argv);
184 int net_rap_printq_usage(struct net_context *c, int argc, const char **argv);
185 int net_rap_printq(struct net_context *c, int argc, const char **argv);
186 int net_rap_user(struct net_context *c, int argc, const char **argv);
187 int net_rap_group_usage(struct net_context *c, int argc, const char **argv);
188 int net_rap_group(struct net_context *c, int argc, const char **argv);
189 int net_rap_groupmember_usage(struct net_context *c, int argc, const char **argv);
190 int net_rap_groupmember(struct net_context *c, int argc, const char **argv);
191 int net_rap_validate_usage(struct net_context *c, int argc, const char **argv);
192 int net_rap_validate(struct net_context *c, int argc, const char **argv);
193 int net_rap_service_usage(struct net_context *c, int argc, const char **argv);
194 int net_rap_service(struct net_context *c, int argc, const char **argv);
195 int net_rap_password_usage(struct net_context *c, int argc, const char **argv);
196 int net_rap_password(struct net_context *c, int argc, const char **argv);
197 int net_rap_admin_usage(struct net_context *c, int argc, const char **argv);
198 int net_rap_admin(struct net_context *c, int argc, const char **argv);
199 int net_rap_usage(struct net_context *c, int argc, const char **argv);
200 int net_rap_help(struct net_context *c, int argc, const char **argv);
201 int net_rap(struct net_context *c, int argc, const char **argv);
202
203 /* The following definitions come from utils/net_registry.c  */
204
205 int net_registry(struct net_context *c, int argc, const char **argv);
206
207 /* The following definitions come from utils/net_rpc.c  */
208
209 NTSTATUS net_get_remote_domain_sid(struct cli_state *cli, TALLOC_CTX *mem_ctx,
210                                    DOM_SID **domain_sid,
211                                    const char **domain_name);
212 int run_rpc_command(struct net_context *c,
213                         struct cli_state *cli_arg,
214                         const int pipe_idx,
215                         int conn_flags,
216                         rpc_command_fn fn,
217                         int argc,
218                         const char **argv);
219 int net_rpc_changetrustpw(struct net_context *c, int argc, const char **argv);
220 int net_rpc_join(struct net_context *c, int argc, const char **argv);
221 NTSTATUS rpc_info_internals(struct net_context *c,
222                         const DOM_SID *domain_sid,
223                         const char *domain_name,
224                         struct cli_state *cli,
225                         struct rpc_pipe_client *pipe_hnd,
226                         TALLOC_CTX *mem_ctx,
227                         int argc,
228                         const char **argv);
229 int net_rpc_info(struct net_context *c, int argc, const char **argv);
230 int net_rpc_getsid(struct net_context *c, int argc, const char **argv);
231 int net_rpc_user(struct net_context *c, int argc, const char **argv);
232 struct rpc_sh_cmd *net_rpc_user_edit_cmds(struct net_context *c,
233                                           TALLOC_CTX *mem_ctx,
234                                           struct rpc_sh_ctx *ctx);
235 struct rpc_sh_cmd *net_rpc_user_cmds(struct net_context *c,
236                                      TALLOC_CTX *mem_ctx,
237                                      struct rpc_sh_ctx *ctx);
238 int net_rpc_group(struct net_context *c, int argc, const char **argv);
239 bool copy_top_level_perms(struct net_context *c,
240                                 struct copy_clistate *cp_clistate,
241                                 const char *sharename);
242 int net_usersidlist(struct net_context *c, int argc, const char **argv);
243 int net_usersidlist_usage(struct net_context *c, int argc, const char **argv);
244 int net_rpc_share(struct net_context *c, int argc, const char **argv);
245 struct rpc_sh_cmd *net_rpc_share_cmds(struct net_context *c, TALLOC_CTX *mem_ctx,
246                                       struct rpc_sh_ctx *ctx);
247 int net_rpc_file(struct net_context *c, int argc, const char **argv);
248 NTSTATUS rpc_init_shutdown_internals(struct net_context *c,
249                                      const DOM_SID *domain_sid,
250                                      const char *domain_name,
251                                      struct cli_state *cli,
252                                      struct rpc_pipe_client *pipe_hnd,
253                                      TALLOC_CTX *mem_ctx,
254                                      int argc,
255                                      const char **argv);
256 NTSTATUS rpc_reg_shutdown_internals(struct net_context *c,
257                                     const DOM_SID *domain_sid,
258                                     const char *domain_name,
259                                     struct cli_state *cli,
260                                     struct rpc_pipe_client *pipe_hnd,
261                                     TALLOC_CTX *mem_ctx,
262                                     int argc,
263                                     const char **argv);
264 bool net_rpc_check(struct net_context *c, unsigned flags);
265 int rpc_printer_migrate(struct net_context *c, int argc, const char **argv);
266 int rpc_printer_usage(struct net_context *c, int argc, const char **argv);
267 int net_rpc_printer(struct net_context *c, int argc, const char **argv);
268 int net_rpc_usage(struct net_context *c, int argc, const char **argv);
269 int net_rpc_help(struct net_context *c, int argc, const char **argv);
270 int net_rpc(struct net_context *c, int argc, const char **argv);
271
272 /* The following definitions come from utils/net_rpc_audit.c  */
273
274 int net_rpc_audit(struct net_context *c, int argc, const char **argv);
275
276 /* The following definitions come from utils/net_rpc_join.c  */
277
278 NTSTATUS net_rpc_join_ok(struct net_context *c, const char *domain,
279                          const char *server, struct sockaddr_storage *pss);
280 int net_rpc_join_newstyle(struct net_context *c, int argc, const char **argv);
281 int net_rpc_testjoin(struct net_context *c, int argc, const char **argv);
282
283 /* The following definitions come from utils/net_rpc_printer.c  */
284
285 NTSTATUS net_copy_fileattr(struct net_context *c,
286                   TALLOC_CTX *mem_ctx,
287                   struct cli_state *cli_share_src,
288                   struct cli_state *cli_share_dst,
289                   const char *src_name, const char *dst_name,
290                   bool copy_acls, bool copy_attrs,
291                   bool copy_timestamps, bool is_file);
292 NTSTATUS net_copy_file(struct net_context *c,
293                        TALLOC_CTX *mem_ctx,
294                        struct cli_state *cli_share_src,
295                        struct cli_state *cli_share_dst,
296                        const char *src_name, const char *dst_name,
297                        bool copy_acls, bool copy_attrs,
298                        bool copy_timestamps, bool is_file);
299 NTSTATUS rpc_printer_list_internals(struct net_context *c,
300                                         const DOM_SID *domain_sid,
301                                         const char *domain_name,
302                                         struct cli_state *cli,
303                                         struct rpc_pipe_client *pipe_hnd,
304                                         TALLOC_CTX *mem_ctx,
305                                         int argc,
306                                         const char **argv);
307 NTSTATUS rpc_printer_driver_list_internals(struct net_context *c,
308                                                 const DOM_SID *domain_sid,
309                                                 const char *domain_name,
310                                                 struct cli_state *cli,
311                                                 struct rpc_pipe_client *pipe_hnd,
312                                                 TALLOC_CTX *mem_ctx,
313                                                 int argc,
314                                                 const char **argv);
315 NTSTATUS rpc_printer_publish_publish_internals(struct net_context *c,
316                                                 const DOM_SID *domain_sid,
317                                                 const char *domain_name,
318                                                 struct cli_state *cli,
319                                                 struct rpc_pipe_client *pipe_hnd,
320                                                 TALLOC_CTX *mem_ctx,
321                                                 int argc,
322                                                 const char **argv);
323 NTSTATUS rpc_printer_publish_unpublish_internals(struct net_context *c,
324                                                 const DOM_SID *domain_sid,
325                                                 const char *domain_name,
326                                                 struct cli_state *cli,
327                                                 struct rpc_pipe_client *pipe_hnd,
328                                                 TALLOC_CTX *mem_ctx,
329                                                 int argc,
330                                                 const char **argv);
331 NTSTATUS rpc_printer_publish_update_internals(struct net_context *c,
332                                                 const DOM_SID *domain_sid,
333                                                 const char *domain_name,
334                                                 struct cli_state *cli,
335                                                 struct rpc_pipe_client *pipe_hnd,
336                                                 TALLOC_CTX *mem_ctx,
337                                                 int argc,
338                                                 const char **argv);
339 NTSTATUS rpc_printer_publish_list_internals(struct net_context *c,
340                                                 const DOM_SID *domain_sid,
341                                                 const char *domain_name,
342                                                 struct cli_state *cli,
343                                                 struct rpc_pipe_client *pipe_hnd,
344                                                 TALLOC_CTX *mem_ctx,
345                                                 int argc,
346                                                 const char **argv);
347 NTSTATUS rpc_printer_migrate_security_internals(struct net_context *c,
348                                                 const DOM_SID *domain_sid,
349                                                 const char *domain_name,
350                                                 struct cli_state *cli,
351                                                 struct rpc_pipe_client *pipe_hnd,
352                                                 TALLOC_CTX *mem_ctx,
353                                                 int argc,
354                                                 const char **argv);
355 NTSTATUS rpc_printer_migrate_forms_internals(struct net_context *c,
356                                                 const DOM_SID *domain_sid,
357                                                 const char *domain_name,
358                                                 struct cli_state *cli,
359                                                 struct rpc_pipe_client *pipe_hnd,
360                                                 TALLOC_CTX *mem_ctx,
361                                                 int argc,
362                                                 const char **argv);
363 NTSTATUS rpc_printer_migrate_drivers_internals(struct net_context *c,
364                                                 const DOM_SID *domain_sid,
365                                                 const char *domain_name,
366                                                 struct cli_state *cli,
367                                                 struct rpc_pipe_client *pipe_hnd,
368                                                 TALLOC_CTX *mem_ctx,
369                                                 int argc,
370                                                 const char **argv);
371 NTSTATUS rpc_printer_migrate_printers_internals(struct net_context *c,
372                                                 const DOM_SID *domain_sid,
373                                                 const char *domain_name,
374                                                 struct cli_state *cli,
375                                                 struct rpc_pipe_client *pipe_hnd,
376                                                 TALLOC_CTX *mem_ctx,
377                                                 int argc,
378                                                 const char **argv);
379 NTSTATUS rpc_printer_migrate_settings_internals(struct net_context *c,
380                                                 const DOM_SID *domain_sid,
381                                                 const char *domain_name,
382                                                 struct cli_state *cli,
383                                                 struct rpc_pipe_client *pipe_hnd,
384                                                 TALLOC_CTX *mem_ctx,
385                                                 int argc,
386                                                 const char **argv);
387
388 /* The following definitions come from utils/net_rpc_registry.c  */
389
390 int net_rpc_registry(struct net_context *c, int argc, const char **argv);
391
392 /* The following definitions come from utils/net_rpc_rights.c  */
393
394 int net_rpc_rights(struct net_context *c, int argc, const char **argv);
395 struct rpc_sh_cmd *net_rpc_rights_cmds(struct net_context *c, TALLOC_CTX *mem_ctx,
396                                        struct rpc_sh_ctx *ctx);
397
398 /* The following definitions come from utils/net_rpc_samsync.c  */
399
400 NTSTATUS rpc_samdump_internals(struct net_context *c,
401                                 const DOM_SID *domain_sid,
402                                 const char *domain_name,
403                                 struct cli_state *cli,
404                                 struct rpc_pipe_client *pipe_hnd,
405                                 TALLOC_CTX *mem_ctx,
406                                 int argc,
407                                 const char **argv);
408 int rpc_vampire_usage(struct net_context *c, int argc, const char **argv);
409 NTSTATUS rpc_vampire_internals(struct net_context *c,
410                                 const DOM_SID *domain_sid,
411                                 const char *domain_name,
412                                 struct cli_state *cli,
413                                 struct rpc_pipe_client *pipe_hnd,
414                                 TALLOC_CTX *mem_ctx,
415                                 int argc,
416                                 const char **argv);
417
418 /* The following definitions come from utils/net_rpc_service.c  */
419
420 const char *svc_status_string( uint32 state );
421 int net_rpc_service(struct net_context *c, int argc, const char **argv);
422
423 /* The following definitions come from utils/net_rpc_sh_acct.c  */
424
425 struct rpc_sh_cmd *net_rpc_acct_cmds(struct net_context *c, TALLOC_CTX *mem_ctx,
426                                      struct rpc_sh_ctx *ctx);
427
428 /* The following definitions come from utils/net_rpc_shell.c  */
429
430 int net_rpc_shell(struct net_context *c, int argc, const char **argv);
431
432 /* The following definitions come from utils/net_sam.c  */
433
434 int net_sam(struct net_context *c, int argc, const char **argv);
435
436 /* The following definitions come from utils/net_status.c  */
437
438 int net_status(struct net_context *c, int argc, const char **argv);
439
440 /* The following definitions come from utils/net_time.c  */
441
442 int net_time_usage(struct net_context *c, int argc, const char **argv);
443 int net_time(struct net_context *c, int argc, const char **argv);
444
445 /* The following definitions come from utils/net_usershare.c  */
446
447 int net_usershare_usage(struct net_context *c, int argc, const char **argv);
448 int net_usershare_help(struct net_context *c, int argc, const char **argv);
449 int net_usershare(struct net_context *c, int argc, const char **argv);
450
451 /* The following definitions come from utils/net_util.c  */
452
453 NTSTATUS net_rpc_lookup_name(struct net_context *c,
454                              TALLOC_CTX *mem_ctx, struct cli_state *cli,
455                              const char *name, const char **ret_domain,
456                              const char **ret_name, DOM_SID *ret_sid,
457                              enum lsa_SidType *ret_type);
458
459 /* The following definitions come from utils/netlookup.c  */
460
461 NTSTATUS net_lookup_name_from_sid(struct net_context *c,
462                                 TALLOC_CTX *ctx,
463                                 DOM_SID *psid,
464                                 const char **ppdomain,
465                                 const char **ppname);
466 NTSTATUS net_lookup_sid_from_name(struct net_context *c, TALLOC_CTX *ctx,
467                                   const char *full_name, DOM_SID *pret_sid);
468
469 /* The following definitions come from utils/passwd_util.c  */
470
471 char *stdin_new_passwd( void);
472 char *get_pass( const char *prompt, bool stdin_get);
473
474 #endif /*  _NET_PROTO_H_  */