Add NetWkstaGetInfo.
[mat/samba.git] / source3 / lib / netapi / tests / common.h
1 /*
2  *  Unix SMB/CIFS implementation.
3  *  NetApi testsuite
4  *  Copyright (C) Guenther Deschner 2008
5  *
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 3 of the License, or
9  *  (at your option) any later version.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
18  */
19
20 #include <popt.h>
21
22 void popt_common_callback(poptContext con,
23                          enum poptCallbackReason reason,
24                          const struct poptOption *opt,
25                          const char *arg, const void *data);
26
27 extern struct poptOption popt_common_netapi_examples[];
28
29 #define POPT_COMMON_LIBNETAPI_EXAMPLES { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_netapi_examples, 0, "Common samba netapi example options:", NULL },
30
31 #ifndef POPT_TABLEEND
32 #define POPT_TABLEEND { NULL, '\0', 0, 0, 0, NULL, NULL }
33 #endif
34
35 NET_API_STATUS test_netuseradd(const char *hostname,
36                                const char *username);
37
38 NET_API_STATUS netapitest_localgroup(struct libnetapi_ctx *ctx,
39                                      const char *hostname);
40 NET_API_STATUS netapitest_user(struct libnetapi_ctx *ctx,
41                                const char *hostname);
42 NET_API_STATUS netapitest_group(struct libnetapi_ctx *ctx,
43                                 const char *hostname);
44 NET_API_STATUS netapitest_display(struct libnetapi_ctx *ctx,
45                                   const char *hostname);
46 NET_API_STATUS netapitest_share(struct libnetapi_ctx *ctx,
47                                 const char *hostname);
48 NET_API_STATUS netapitest_file(struct libnetapi_ctx *ctx,
49                                const char *hostname);
50 NET_API_STATUS netapitest_server(struct libnetapi_ctx *ctx,
51                                  const char *hostname);
52 NET_API_STATUS netapitest_wksta(struct libnetapi_ctx *ctx,
53                                 const char *hostname);
54
55 #ifndef ARRAY_SIZE
56 #define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0]))
57 #endif
58
59 #define NETAPI_STATUS(x,y,fn) \
60         printf("FAILURE: line %d: %s failed with status: %s (%d)\n", \
61                 __LINE__, fn, libnetapi_get_error_string(x,y), y);
62
63 #define NETAPI_STATUS_MSG(x,y,fn,z) \
64         printf("FAILURE: line %d: %s failed with status: %s (%d), %s\n", \
65                 __LINE__, fn, libnetapi_get_error_string(x,y), y, z);
66
67 #define ZERO_STRUCT(x) memset((char *)&(x), 0, sizeof(x))