File: dse_cmd_disallow.c

package info (click to toggle)
fis-gtm 6.3-007-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 36,284 kB
  • sloc: ansic: 328,861; asm: 5,182; csh: 5,102; sh: 1,918; awk: 291; makefile: 69; sed: 13
file content (316 lines) | stat: -rw-r--r-- 10,493 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
/****************************************************************
 *								*
 * Copyright (c) 2003-2017 Fidelity National Information	*
 * Services, Inc. and/or its subsidiaries. All rights reserved.	*
 *								*
 *	This source code contains the intellectual property	*
 *	of its copyright holder(s), and is made available	*
 *	under a license.  If you do not know the terms of	*
 *	the license, please stop and do not read further.	*
 *								*
 ****************************************************************/

#include "mdef.h"

#include "gtm_stdio.h"
#include "gtm_string.h"
#include "cli.h"
#include "cli_parse.h"
#include "cli_disallow.h"
#include "dse_cmd_disallow.h"

GBLREF	char	*cli_err_str_ptr;

boolean_t cli_disallow_dse_add(void)
{
	int disallow_return_value = 0;

	*cli_err_str_ptr = 0;
	disallow_return_value = d_c_cli_present("STAR") && (d_c_cli_present("DATA")
								|| d_c_cli_present("KEY")
								|| d_c_cli_present("RECORD")
								|| d_c_cli_present("OFFSET"));
	CLI_DIS_CHECK_N_RESET;
	disallow_return_value = d_c_cli_present("DATA") && d_c_cli_present("POINTER");
	CLI_DIS_CHECK_N_RESET;
	disallow_return_value = d_c_cli_present("RECORD") && d_c_cli_present("OFFSET");
	CLI_DIS_CHECK_N_RESET;
	return FALSE;
}

boolean_t cli_disallow_dse_all(void)
{
	int disallow_return_value = 0;

	*cli_err_str_ptr = 0;
	disallow_return_value = d_c_cli_present("WCINIT") && d_c_cli_present("BUFFER_FLUSH");
	CLI_DIS_CHECK_N_RESET;
	disallow_return_value = d_c_cli_present("RENEW") && (d_c_cli_present("FREEZE")
								|| d_c_cli_present("SEIZE")
								|| d_c_cli_present("RELEASE")
								|| d_c_cli_present("CRITINIT")
								|| d_c_cli_present("BUFFER_FLUSH")
								|| d_c_cli_present("REFERENCE")
								|| d_c_cli_present("WCINIT")
								|| d_c_cli_present("OVERRIDE"));
	CLI_DIS_CHECK_N_RESET;
	disallow_return_value = d_c_cli_present("SEIZE") && d_c_cli_present("RELEASE");
	CLI_DIS_CHECK_N_RESET;
	disallow_return_value = d_c_cli_present("CRITINIT") && (d_c_cli_present("SEIZE") || d_c_cli_present("RELEASE"));
	CLI_DIS_CHECK_N_RESET;
	disallow_return_value = d_c_cli_present("DUMP") && (d_c_cli_present("BUFFER_FLUSH")
								|| d_c_cli_present("CRITINIT")
								|| d_c_cli_present("FREEZE")
								|| d_c_cli_present("OVERRIDE")
								|| d_c_cli_present("REFERENCE")
								|| d_c_cli_present("RELEASE")
								|| d_c_cli_present("RENEW")
								|| d_c_cli_present("SEIZE")
								|| d_c_cli_present("WCINIT"));
	CLI_DIS_CHECK_N_RESET;
	disallow_return_value = d_c_cli_present("ALL") && !d_c_cli_present("DUMP");
	CLI_DIS_CHECK_N_RESET;
	return FALSE;
}

boolean_t cli_disallow_dse_cache(void)
{
	int		disallow_return_value = 0;
	boolean_t	p1, p2, p3, p4;

	*cli_err_str_ptr = 0;

	p1 = d_c_cli_present("CHANGE");
	p2 = d_c_cli_present("RECOVER");
	p3 = d_c_cli_present("SHOW");
	p4 = d_c_cli_present("VERIFY");

	/* any DSE CACHE command should contain at LEAST one of the above qualifiers */
	disallow_return_value = !(p1 || p2 || p3 || p4);
	CLI_DIS_CHECK;	/* Note CLI_DIS_CHECK_N_RESET is not used as we want to reuse the computed error string (cli_err_str_ptr)
			 * for the next check as well in case it fails. Note that this can be done only if both checks use
			 * exactly the same set of qualifiers (which is TRUE in this case). */

	/* any DSE CACHE command should contain at MOST one of the above qualifiers */
	disallow_return_value = cli_check_any2(VARLSTCNT(4) p1, p2, p3, p4);
	CLI_DIS_CHECK_N_RESET;

	disallow_return_value = d_c_cli_present("ALL") && d_c_cli_present("CHANGE");
	CLI_DIS_CHECK_N_RESET;
	disallow_return_value = !(d_c_cli_present("CHANGE") || d_c_cli_present("SHOW")) && (d_c_cli_present("OFFSET")
												|| d_c_cli_present("SIZE")
												|| d_c_cli_present("VALUE"));
	CLI_DIS_CHECK_N_RESET;
	disallow_return_value = d_c_cli_present("SHOW") && d_c_cli_present("VALUE");
	CLI_DIS_CHECK_N_RESET;
	disallow_return_value = d_c_cli_present("CHANGE") && !d_c_cli_present("OFFSET");
	CLI_DIS_CHECK_N_RESET;
	disallow_return_value = d_c_cli_present("OFFSET") && !d_c_cli_present("SIZE");
	CLI_DIS_CHECK_N_RESET;
	disallow_return_value = d_c_cli_present("SIZE") && !d_c_cli_present("OFFSET");
	CLI_DIS_CHECK_N_RESET;
	disallow_return_value = d_c_cli_present("VALUE") && !d_c_cli_present("OFFSET");
	CLI_DIS_CHECK_N_RESET;
	disallow_return_value = d_c_cli_negated("CRIT") && (d_c_cli_present("CHANGE")
								|| d_c_cli_present("RECOVER")
								|| d_c_cli_present("VERIFY"));
	CLI_DIS_CHECK_N_RESET;
	return FALSE;
}

boolean_t cli_disallow_dse_change(void)
{
	int disallow_return_value = 0;

	*cli_err_str_ptr = 0;
	disallow_return_value = d_c_cli_present("FILEHEADER") && (d_c_cli_present("BLOCK")
								|| d_c_cli_present("LEVEL")
								|| d_c_cli_present("BSIZ")
								|| d_c_cli_present("RECORD")
								|| d_c_cli_present("OFFSET")
								|| d_c_cli_present("CMPC")
								|| d_c_cli_present("RSIZ")
								|| d_c_cli_present("TN"));
	CLI_DIS_CHECK_N_RESET;
	disallow_return_value =        (   d_c_cli_present("LEVEL")
					|| d_c_cli_present("BSIZ")
					|| d_c_cli_present("TN"))
							&&     (   d_c_cli_present("RECORD")
								|| d_c_cli_present("OFFSET")
								|| d_c_cli_present("CMPC")
								|| d_c_cli_present("RSIZ"));
	CLI_DIS_CHECK_N_RESET;
	disallow_return_value = d_c_cli_present("RECORD") && d_c_cli_present("OFFSET");
	CLI_DIS_CHECK_N_RESET;
	return FALSE;
}

boolean_t cli_disallow_dse_chng_fhead(void)
{
	int		disallow_return_value = 0;

	disallow_return_value = d_c_cli_present("STRM_NUM") && !d_c_cli_present("STRM_REG_SEQNO");
	CLI_DIS_CHECK_N_RESET;
	disallow_return_value = !d_c_cli_present("STRM_NUM") && d_c_cli_present("STRM_REG_SEQNO");
	CLI_DIS_CHECK_N_RESET;
	return FALSE;
}

boolean_t cli_disallow_dse_crit(void)
{
	int		disallow_return_value = 0;
	boolean_t	p1, p2, p3, p4, p5;

	*cli_err_str_ptr = 0;

	p1 = d_c_cli_present("INIT");
	p2 = d_c_cli_present("OWNER");
	p3 = d_c_cli_present("SEIZE");
	p4 = d_c_cli_present("RELEASE");
	p5 = d_c_cli_present("REMOVE");
	disallow_return_value = cli_check_any2(VARLSTCNT(5) p1, p2, p3, p4, p5);
	CLI_DIS_CHECK_N_RESET;

	disallow_return_value = d_c_cli_present("CRASH") && (d_c_cli_present("SEIZE")
								|| d_c_cli_present("RELEASE")
								|| d_c_cli_present("OWNER")
								|| d_c_cli_present("RESET"));
	CLI_DIS_CHECK_N_RESET;
	disallow_return_value = d_c_cli_present("RESET") && (d_c_cli_present("SEIZE")
								|| d_c_cli_present("RELEASE")
								|| d_c_cli_present("OWNER"));
	CLI_DIS_CHECK_N_RESET;
	disallow_return_value = d_c_cli_present("CYCLE") && (d_c_cli_present("INIT")
								|| d_c_cli_present("REMOVE")
								|| d_c_cli_present("SEIZE")
								|| d_c_cli_present("RELEASE")
								|| d_c_cli_present("RESET"));
	CLI_DIS_CHECK_N_RESET;
	disallow_return_value = d_c_cli_present("ALL") && (d_c_cli_present("CRASH")
								|| d_c_cli_present("CYCLE")
								|| d_c_cli_present("INIT")
								|| d_c_cli_present("OWNER")
								|| d_c_cli_present("RELEASE")
								|| d_c_cli_present("REMOVE")
								|| d_c_cli_present("RESET")
								|| d_c_cli_present("SEIZE"));
	CLI_DIS_CHECK_N_RESET;
	return FALSE;
}

boolean_t cli_disallow_dse_dump(void)
{
	int		disallow_return_value = 0;
	boolean_t	p1, p2, p3;

	*cli_err_str_ptr = 0;

	p1 = d_c_cli_present("RECORD");
	p2 = d_c_cli_present("OFFSET");
	p3 = d_c_cli_present("FILEHEADER");
	disallow_return_value = cli_check_any2(VARLSTCNT(3) p1, p2, p3);
	CLI_DIS_CHECK_N_RESET;

	disallow_return_value = d_c_cli_present("FILEHEADER") && (d_c_cli_present("BLOCK")
								|| d_c_cli_present("HEADER")
								|| d_c_cli_present("COUNT")
								|| d_c_cli_present("GLO")
								|| d_c_cli_present("ZWR"));
	CLI_DIS_CHECK_N_RESET;
	disallow_return_value = d_c_cli_present("GLO") && d_c_cli_present("ZWR");
	CLI_DIS_CHECK_N_RESET;
	disallow_return_value = d_c_cli_present("GLO") && d_c_cli_present("HEADER");
	CLI_DIS_CHECK_N_RESET;
	disallow_return_value = d_c_cli_present("ZWR") && d_c_cli_present("HEADER");
	CLI_DIS_CHECK_N_RESET;
	disallow_return_value = d_c_cli_present("COUNT") && !d_c_cli_present("HEADER")
					&& !(d_c_cli_present("RECORD") || d_c_cli_present("OFFSET")) && !d_c_cli_present("BLOCK");
	CLI_DIS_CHECK_N_RESET;
	return FALSE;
}

boolean_t cli_disallow_dse_find(void)
{
	int		disallow_return_value = 0;
	boolean_t	p1, p2, p3, p4;

	*cli_err_str_ptr = 0;

	p1 = d_c_cli_present("BLOCK");
	p2 = d_c_cli_present("FREEBLOCK");
	p3 = d_c_cli_present("KEY");
	p4 = d_c_cli_present("REGION");
	disallow_return_value = cli_check_any2(VARLSTCNT(4) p1, p2, p3, p4);
	CLI_DIS_CHECK_N_RESET;

	disallow_return_value = (	   d_c_cli_present("EXHAUSTIVE")
					|| d_c_cli_present("SIBLINGS"))
							&& (	   d_c_cli_present("FREEBLOCK")
								|| d_c_cli_present("KEY")
								|| d_c_cli_present("REGION"));
	CLI_DIS_CHECK_N_RESET;
	disallow_return_value = d_c_cli_present("HINT") && !d_c_cli_present("FREEBLOCK");
	CLI_DIS_CHECK_N_RESET;
	disallow_return_value = d_c_cli_present("FREEBLOCK") && !d_c_cli_present("HINT");
	CLI_DIS_CHECK_N_RESET;
	disallow_return_value = d_c_cli_present("STATS") && !d_c_cli_present("REGION");
	CLI_DIS_CHECK_N_RESET;
	return FALSE;
}

boolean_t cli_disallow_dse_maps(void)
{
	int		disallow_return_value = 0;
	boolean_t	p1, p2, p3, p4;

	*cli_err_str_ptr = 0;

	p1 = d_c_cli_present("FREE");
	p2 = d_c_cli_present("BUSY");
	p3 = d_c_cli_present("MASTER");
	p4 = d_c_cli_present("RESTORE_ALL");
	disallow_return_value = cli_check_any2(VARLSTCNT(4) p1, p2, p3, p4);
	CLI_DIS_CHECK_N_RESET;

	disallow_return_value = d_c_cli_present("BLOCK") && d_c_cli_present("RESTORE_ALL");
	CLI_DIS_CHECK_N_RESET;
	return FALSE;
}

boolean_t cli_disallow_dse_remove(void)
{
	int		disallow_return_value = 0;
	boolean_t	p1, p2, p3;

	*cli_err_str_ptr = 0;

	p1 = d_c_cli_present("RECORD");
	p2 = d_c_cli_present("OFFSET");
	p3 = d_c_cli_present("VERSION");
	disallow_return_value = cli_check_any2(VARLSTCNT(3) p1, p2, p3);
	CLI_DIS_CHECK_N_RESET;

	disallow_return_value = d_c_cli_present("VERSION") && d_c_cli_present("COUNT");
	CLI_DIS_CHECK_N_RESET;
	return FALSE;
}

boolean_t cli_disallow_dse_save(void)
{
	int disallow_return_value = 0;

	*cli_err_str_ptr = 0;
	disallow_return_value = d_c_cli_present("LIST") && d_c_cli_present("COMMENT");
	CLI_DIS_CHECK_N_RESET;
	return FALSE;
}

boolean_t cli_disallow_dse_shift(void)
{
	int disallow_return_value = 0;

	*cli_err_str_ptr = 0;
	disallow_return_value = d_c_cli_present("FORWARD") && d_c_cli_present("BACKWARD");
	CLI_DIS_CHECK_N_RESET;
	return FALSE;
}