File: cli_cmds.h

package info (click to toggle)
varnish 7.7.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,256 kB
  • sloc: ansic: 104,222; python: 2,679; makefile: 1,303; sh: 1,077; awk: 114; perl: 105; ruby: 41
file content (456 lines) | stat: -rw-r--r-- 12,276 bytes parent folder | download | duplicates (2)
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
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
/*-
 * Copyright (c) 2006 Verdens Gang AS
 * Copyright (c) 2006-2011 Varnish Software AS
 * All rights reserved.
 *
 * Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 * These macros define the common data for requests in the CLI protocol.
 * The fields are:
 *	const char *	upper-case C-ident request_name
 *	const char *	request_name
 *	const char *	request_syntax (for short help)
 *	const char *	request_help (for long help)
 *	const char *	documentation (for sphinx)
 *	int		minimum_arguments
 *	int		maximum_arguments
 */

/*lint -save -e525 -e539 */

CLI_CMD(BAN,
	"ban",
	"ban <field> <operator> <arg> [&& <field> <oper> <arg> ...]",
	"Mark obsolete all objects where all the conditions match.",
	"  See :ref:`vcl(7)_ban` for details",
	3, -1
)

CLI_CMD(BAN_LIST,
	"ban.list",
	"ban.list [-j]",
	"List the active bans.",

	"  Unless ``-j`` is specified for JSON output, "
	" the output format is:\n\n"
	"  * Time the ban was issued.\n\n"
	"  * Objects referencing this ban.\n\n"
	"  * ``C`` if ban is completed = no further testing against it.\n\n"
	"  * if ``lurker`` debugging is enabled:\n\n"
	"    * ``R`` for req.* tests\n\n"
	"    * ``O`` for obj.* tests\n\n"
	"    * Pointer to ban object\n\n"
	"  * Ban specification\n\n"
	"  Durations of ban specifications get normalized, for example \"7d\""
	" gets changed into \"1w\".",

	0, 0
)

CLI_CMD(VCL_LOAD,
	"vcl.load",
	"vcl.load <configname> <filename> [auto|cold|warm]",
	"Compile and load the VCL file under the name provided.",
	"",
	2, 3
)

CLI_CMD(VCL_INLINE,
	"vcl.inline",
	"vcl.inline <configname> <quoted_VCLstring> [auto|cold|warm]",
	"Compile and load the VCL data under the name provided.",

	"  Multi-line VCL can be input using the here document"
	" :ref:`ref_syntax`.",

	2, 3
)

CLI_CMD(VCL_STATE,
	"vcl.state",
	"vcl.state <configname> auto|cold|warm",
	"  Force the state of the named configuration.",
	"",
	2, 2
)

CLI_CMD(VCL_DISCARD,
	"vcl.discard",
	"vcl.discard <name_pattern>...",
	"Unload the named configurations (when possible).",
	"  Unload the named configurations and labels matching at least"
	" one name pattern. All matching configurations and labels"
	" are discarded in the correct order with respect to potential"
	" dependencies. If one configuration or label could not be"
	" discarded because one of its dependencies would remain,"
	" nothing is discarded."
	" Each individual name pattern must match at least one named"
	" configuration or label.",
	1, -1
)

CLI_CMD(VCL_LIST,
	"vcl.list",
	"vcl.list [-j]",
	"List all loaded configuration.",
	"  Unless ``-j`` is specified for JSON output, "
	" the output format is five or seven columns of dynamic width, "
	" separated by white space with the fields:\n\n"
	"  * status: active, available or discarded\n\n"
	"  * state: label, cold, warm, or auto\n\n"
	"  * temperature: init, cold, warm, busy or cooling\n\n"
	"  * busy: number of references to this vcl (integer)\n\n"
	"  * name: the name given to this vcl or label\n\n"
	"  * [ ``<-`` | ``->`` ] and label info last two fields)\n\n"
	"    * ``->`` <vcl> : label \"points to\" the named <vcl>\n\n"
	"    * ``<-`` (<n> label[s]): the vcl has <n> label(s)\n\n",
	0, 0
)

CLI_CMD(VCL_DEPS,
	"vcl.deps",
	"vcl.deps [-j]",
	"List all loaded configuration and their dependencies.",
	"  Unless ``-j`` is specified for JSON output, the"
	" output format is up to two columns of dynamic width"
	" separated by white space with the fields:\n\n"
	"  * VCL: a VCL program\n\n"
	"  * Dependency: another VCL program it depends on\n\n"
	"  Only direct dependencies are listed, and VCLs with"
	" multiple dependencies are listed multiple times.",
	0, 0
)

CLI_CMD(VCL_SHOW,
	"vcl.show",
	"vcl.show [-v] [<configname>]",
	"Display the source code for the specified configuration.",
	"",
	0, 2
)

CLI_CMD(VCL_USE,
	"vcl.use",
	"vcl.use <configname|label>",
	"Switch to the named configuration immediately.",
	"",
	1, 1
)

CLI_CMD(VCL_LABEL,
	"vcl.label",
	"vcl.label <label> <configname>",
	"Apply label to configuration.",
	"  A VCL label is like a UNIX symbolic link, "
	" a name without substance, which points to another VCL.\n\n"
	"  Labels are mandatory whenever one VCL references another.",
	2, 2
)

CLI_CMD(PARAM_RESET,
	"param.reset",
	"param.reset [-j] <param>",
	"Reset parameter to default value.",
	"  The JSON output is the same as ``param.show -j <param>`` and"
	" contains the updated value as it would be represented by a"
	" subsequent execution of ``param.show``.\n\n",
	1,1
)

CLI_CMD(PARAM_SHOW,
	"param.show",
	"param.show [-l|-j] [<param>|changed]",
	"Show parameters and their values.",

	"  The long form with ``-l`` shows additional information, including"
	" documentation and minimum, maximum and default values, if defined"
	" for the parameter. JSON output is specified with ``-j``, in which"
	" the information for the long form is included; only one of ``-l`` or"
	" ``-j`` is permitted. If a parameter is specified with ``<param>``,"
	" show only that parameter. If ``changed`` is specified, show only"
	" those parameters whose values differ from their defaults.",
	0, 2
)

CLI_CMD(PARAM_SET,
	"param.set",
	"param.set [-j] <param> <value>",
	"Set parameter value.",
	"  The JSON output is the same as ``param.show -j <param>`` and"
	" contains the updated value as it would be represented by a"
	" subsequent execution of ``param.show``.\n\n"
	"  This can be useful to later verify that a parameter value didn't"
	" change and to use the value from the JSON output to reset the"
	" parameter to the desired value.",
	2,2
)

CLI_CMD(SERVER_STOP,
	"stop",
	"stop",
	"Stop the Varnish cache process.",
	"",
	0, 0
)

CLI_CMD(SERVER_START,
	"start",
	"start",
	"Start the Varnish cache process.",
	"",
	0, 0
)

CLI_CMD(PING,
	"ping",
	"ping [-j] [<timestamp>]",
	"Keep connection alive.",
	"  The response is formatted as JSON if ``-j`` is specified.",
	0, 1
)

CLI_CMD(HELP,
	"help",
	"help [-j|<command>]",
	"Show command/protocol help.",
	"  ``-j`` specifies JSON output.",
	0, 1
)

CLI_CMD(QUIT,
	"quit",
	"quit",
	"Close connection.",
	"",
	0, 0
)

CLI_CMD(SERVER_STATUS,
	"status",
	"status [-j]",
	"Check status of Varnish cache process.",
	"  ``-j`` specifies JSON output.",
	0, 0
)

CLI_CMD(BANNER,
	"banner",
	"banner",
	"Print welcome banner.",
	"",
	0, 0
)

CLI_CMD(AUTH,
	"auth",
	"auth <response>",
	"Authenticate.",
	"",
	1, 1
)

CLI_CMD(PANIC_SHOW,
	"panic.show",
	"panic.show [-j]",
	"Return the last panic, if any.",
	"  ``-j`` specifies JSON output -- the panic message is returned as an"
	" unstructured JSON string.",
	0, 0
)

CLI_CMD(PANIC_CLEAR,
	"panic.clear",
	"panic.clear [-z]",
	"Clear the last panic, if any,"
	" -z will clear related varnishstat counter(s)",
	"",
	0, 1
)

CLI_CMD(DEBUG_LISTEN_ADDRESS,
	"debug.listen_address",
	"debug.listen_address",
	"Report the actual listen address.",
	"",
	0, 0
)

CLI_CMD(BACKEND_LIST,
	"backend.list",
	"backend.list [-j] [-p] [<backend_pattern>]",
	"List backends.\n",
	"  ``-p`` also shows probe status.\n\n"
	"  ``-j`` specifies JSON output.\n\n"
	"  Unless ``-j`` is specified for JSON output, "
	" the output format is five columns of dynamic width, "
	" separated by white space with the fields:\n\n"
	"  * Backend name\n\n"
	"  * Admin: How health state is determined:\n\n"
	"    * ``healthy``: Set ``healthy`` through ``backend.set_health``.\n\n"
	"    * ``sick``: Set ``sick`` through ``backend.set_health``.\n\n"
	"    * ``probe``: Health state determined by a probe or some other\n"
	"      dynamic mechanism.\n\n"
	"    * ``deleted``: Backend has been deleted, but not yet cleaned\n"
	"      up.\n\n"
	"    Admin has precedence over Health\n\n"
	"  * Probe ``X/Y``: *X* out of *Y* checks have succeeded\n\n"
	"    *X* and *Y* are backend specific and may represent probe checks,\n"
	"    other backends or any other metric.\n\n"
	"    If there is no probe or the director does not provide details on\n"
	"    probe check results, ``0/0`` is output.\n\n"
	"  * Health: Probe health state\n\n"
	"    * ``healthy``\n\n"
	"    * ``sick``\n\n"
	"    If there is no probe, ``healthy`` is output.\n"
	"  * Last change: Timestamp when the health state last changed.\n\n"
	"  The health state reported here is generic. A backend's health "
	"may also depend on the context it is being used in (e.g. "
	"the object's hash), so the actual health state as visible "
	"from VCL (e.g. using ``std.healthy()``) may differ.\n\n"
	"  For ``-j``, the object members should be self explanatory,\n"
	"  matching the fields described above. ``probe_message`` has the\n"
	"  format ``[X, Y, \"state\"]`` as described above for Probe. JSON\n"
	"  Probe details (``-j -p`` arguments) are director specific.",
	0, 2
)

CLI_CMD(BACKEND_SET_HEALTH,
	"backend.set_health",
	"backend.set_health <backend_pattern> [auto|healthy|sick]",
	"Set health status of backend(s) matching <backend_pattern>.",
	"  * With ``auto``, the health status is determined by a probe\n"
	"    or some other dynamic mechanism, if any\n"
	"  * ``healthy`` sets the backend as usable\n"
	"  * ``sick`` sets the backend as unusable\n",
	2, 2
)

CLI_CMD(DEBUG_FRAGFETCH,
	"debug.fragfetch",
	"debug.fragfetch",
	"Enable fetch fragmentation.",
	"",
	1, 1
)

CLI_CMD(DEBUG_REQPOOLFAIL,
	"debug.reqpool.fail",
	"debug.reqpool.fail",
	"Schedule req-pool failures.",
	"The argument is read L-R and 'f' means fail:\n\n"
	"\tparam.set debug.reqpoolfail F__F_F\n\n"
	"In the example above the first, fourth and sixth attempted\n"
	"allocations will fail.",
	1, 1
)

CLI_CMD(DEBUG_SHUTDOWN_DELAY,
	"debug.shutdown.delay",
	"debug.shutdown.delay",
	"Add a delay to the child process shutdown.",
	"",
	1, 1
)

CLI_CMD(DEBUG_XID,
	"debug.xid",
	"debug.xid [<xid> [<cachesize>]]",
	"Examine or set XID. <cachesize> defaults to 1.",
	"",
	0, 2
)

CLI_CMD(DEBUG_SRANDOM,
	"debug.srandom",
	"debug.srandom",
	"Seed the random(3) function.",
	"",
	0, 1
)

CLI_CMD(DEBUG_PANIC_WORKER,
	"debug.panic.worker",
	"debug.panic.worker",
	"Panic the worker process.",
	"",
	0, 0
)

CLI_CMD(DEBUG_PANIC_MASTER,
	"debug.panic.master",
	"debug.panic.master",
	"Panic the master process.",
	"",
	0, 0
)

CLI_CMD(DEBUG_VCL_SYMTAB,
	"vcl.symtab",
	"vcl.symtab",
	"Dump the VCL symbol-tables.",
	"",
	0, 0
)

CLI_CMD(DEBUG_VMOD,
	"debug.vmod",
	"debug.vmod",
	"Show loaded vmods.",
	"",
	0, 0
)

CLI_CMD(DEBUG_PERSISTENT,
	"debug.persistent",
	"debug.persistent [<stevedore>] [<cmd>]",
	"Persistent debugging magic:\n"
	"With no cmd arg, a summary of the silo is returned.\n"
	"Possible commands:\n"
	"\tsync\tClose current segment, open a new one\n"
	"\tdump\tinclude objcores in silo summary",
	"",
	0, 2
)

CLI_CMD(STORAGE_LIST,
	"storage.list",
	"storage.list [-j]",
	"List storage devices.",
	"  ``-j`` specifies JSON output.",
	0, 0
)

CLI_CMD(PID,
	"pid",
	"pid [-j]",
	"Show the pid of the master process, and the worker if it's running.",
	"  ``-j`` specifies JSON output.",
	0, 0
)

#undef CLI_CMD

/*lint -restore */