Import Upstream version 1.8.5
[hcoop/debian/openafs.git] / src / rx / test / generator.h
CommitLineData
805e021f
CE
1/*
2 * Copyright 2000, International Business Machines Corporation and others.
3 * All Rights Reserved.
4 *
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
8 */
9
10#define PRIVATE static
11#define IN
12#define INOUT
13#define MACRO_BEGIN do {
14#define MACRO_END } while (0)
15
16
17typedef enum { FALSE, TRUE } boolean_t;
18
19/* no. tests per file */
20#define TESTS_PER_FILE 50
21
22/* no: of elems in dir array */
23#define DIR_SIZE 3
24
25/* no: of elems in typ array */
26#define TYP_SIZE 11
27
28/* max strlength among the lems fo the dir array */
29#define MAX_DIR_STR 7
30
31/* max string length among th lems of the typ array */
32#define MAX_TYP_STR 16
33
34/* arrays size to be generated in the idl and itl files */
35#define IDL_STR_MAX 1000
36#define IDL_FIX_ARRAY_SIZE 15
37
38/* length of vary/conf attrib , eg" length */
39#define ATTRIB_LEN 7
40#define ATTRIB_NO 3
41
42typedef struct {
43 char direction[MAX_DIR_STR];
44 char type[MAX_TYP_STR];
45 int attrib_ct;
46 char attrib[ATTRIB_NO][ATTRIB_LEN];
47 boolean_t first;
48 boolean_t last;
49 boolean_t length;
50 boolean_t max;
51 boolean_t size;
52 unsigned int instringlen;
53 char *inValue[IDL_FIX_ARRAY_SIZE]; /* value passed via RPC */
54 char *inValue2[IDL_FIX_ARRAY_SIZE];
55 char *outValue[IDL_FIX_ARRAY_SIZE]; /* value returned via RPC */
56 char *outValue2[IDL_FIX_ARRAY_SIZE];
57 int vc_low, vc_high, vc_max; /* array bounds ([in] value) */
58 int ovc_low, ovc_high; /* array bounds ([out] value) */
59} arg_tuple;
60
61typedef struct {
62 int argCount;
63 arg_tuple *argDescr;
64} rpcArgs;
65
66#define MEM_CHK(x, y) if(!x) {fprintf(stderr, y); exit(1);}
67
68#define FATAL( y ) {fprintf(stderr, y); exit(1);}
69
70/* for vary/conf array for testing pusrposes we will assume a
71high index of at least 5, so IDL_FIX_ARRAY_SIZE should never be
72smaller than MIN_HIGH */
73#define MIN_HIGH 2
74
75/* max length of server name string -- file names <= 8 Chars, append Mgr,
76and so limit server name to 5 chars */
77#define MAX_SERV_NAME 5
78
79#define PrintShortUsage \
80 MACRO_BEGIN \
81 fprintf( stderr, \
82"Usage: generator [-h] [-l] [-f] <inputFileName> [-s] <serverName> \
83-o <output dir> [-p] <platform> \n"); \
84 MACRO_END
85
86#define PrintLongUsage \
87 MACRO_BEGIN \
88 PrintShortUsage; \
89 fprintf( stderr, \
90"\nCommand line options(case insensitive):\
91\n\t-h = help message \
92\n\t-l = use lwps as the thread model instead of pthreads \
93\n\t-f = set the input table file \
94\n\t-s = set the server name (truncates to 5 chars) \
95\n\t-o = set output directory \
96\n\t-p = set target platform (NT or UNIX - defaults to NT) \
97\n"); \
98 MACRO_END
99
100/* max no: of args 999 */
101#define MAX_DIGITS_IN_ARGS 3
102
103#define MAX_RAND_LENGTH 50
104
105#define MAX_INDEX_DIGITS 10
106
107/* size of rpc signature buffer */
108#define SIGN_SIZE 10000
109
110#define SkipWhiteSpaces(p) \
111MACRO_BEGIN \
112 while (isspace(*(p))) \
113 (p)++; \
114MACRO_END
115
116/* limits for random generation */
117#define MIN_CHAR 32
118#define MAX_CHAR 126
119#define MIN_FLT 0.00000000
120#define MAX_FLT 1.00000000
121#define MIN_DBL 0.0000000000000000
122#define MAX_DBL 1.0000000000000000