netapi: add netapi testsuite.
[Samba/gebeck_regimport.git] / source3 / lib / netapi / tests / common.h
blobed073c0038196b1528c818d65e83854e8dc466a1
1 /*
2 * Unix SMB/CIFS implementation.
3 * NetApi testsuite
4 * Copyright (C) Guenther Deschner 2008
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.
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.
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/>.
20 #include <popt.h>
22 void popt_common_callback(poptContext con,
23 enum poptCallbackReason reason,
24 const struct poptOption *opt,
25 const char *arg, const void *data);
27 extern struct poptOption popt_common_netapi_examples[];
29 #define POPT_COMMON_LIBNETAPI_EXAMPLES { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_netapi_examples, 0, "Common samba netapi example options:", NULL },
31 NET_API_STATUS test_netuseradd(const char *hostname,
32 const char *username);
34 NET_API_STATUS netapitest_localgroup(struct libnetapi_ctx *ctx,
35 const char *hostname);
36 NET_API_STATUS netapitest_user(struct libnetapi_ctx *ctx,
37 const char *hostname);
38 NET_API_STATUS netapitest_group(struct libnetapi_ctx *ctx,
39 const char *hostname);
40 NET_API_STATUS netapitest_display(struct libnetapi_ctx *ctx,
41 const char *hostname);
43 #ifndef ARRAY_SIZE
44 #define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0]))
45 #endif
47 #define NETAPI_STATUS(x,y,fn) \
48 printf("FAILURE: line %d: %s failed with status: %s (%d)\n", \
49 __LINE__, fn, libnetapi_get_error_string(x,y), y);
51 #define NETAPI_STATUS_MSG(x,y,fn,z) \
52 printf("FAILURE: line %d: %s failed with status: %s (%d), %s\n", \
53 __LINE__, fn, libnetapi_get_error_string(x,y), y, z);
55 #define ZERO_STRUCT(x) memset((char *)&(x), 0, sizeof(x))