blob: f55239adf6d6a7476c2e11d4ce79be719d78ba48 [file] [log] [blame]
Neels Hofmeyr0fd615f2019-01-26 20:36:12 +01001/*! \file tdef_vty.h
2 * API to configure osmo_tdef Tnnn timers from VTY configuration.
3 */
4/* (C) 2018-2019 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de>
5 *
6 * Author: Neels Hofmeyr <neels@hofmeyr.de>
7 *
8 * All Rights Reserved
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU Affero General Public License as published by
12 * the Free Software Foundation; either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Affero General Public License for more details.
19 *
20 * You should have received a copy of the GNU Affero General Public License
21 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 */
23#pragma once
24
25#include <stdint.h>
26
27struct vty;
28
29/*! \defgroup Tdef_VTY Tnnn timer VTY configuration
30 * @{
31 * \file tdef_vty.h
32 */
33
34struct osmo_tdef;
35struct osmo_tdef_group;
36
37#define OSMO_TDEF_VTY_ARG_T "TNNNN"
38#define OSMO_TDEF_VTY_DOC_T "T-number, optionally preceded by 't' or 'T'.\n"
39#define OSMO_TDEF_VTY_ARG_T_OPTIONAL "[" OSMO_TDEF_VTY_ARG_T "]"
40
41#define OSMO_TDEF_VTY_ARG_VAL "(<0-2147483647>|default)"
42#define OSMO_TDEF_VTY_DOC_VAL "New timer value\n" "Set to default timer value\n"
43#define OSMO_TDEF_VTY_ARG_VAL_OPTIONAL "[" OSMO_TDEF_VTY_ARG_VAL "]"
44
45#define OSMO_TDEF_VTY_ARG_SET OSMO_TDEF_VTY_ARG_T " " OSMO_TDEF_VTY_ARG_VAL
46#define OSMO_TDEF_VTY_DOC_SET OSMO_TDEF_VTY_DOC_T OSMO_TDEF_VTY_DOC_VAL
47#define OSMO_TDEF_VTY_ARG_SET_OPTIONAL OSMO_TDEF_VTY_ARG_T_OPTIONAL " " OSMO_TDEF_VTY_ARG_VAL_OPTIONAL
48
49int osmo_tdef_vty_set_cmd(struct vty *vty, struct osmo_tdef *tdefs, const char **args);
50int osmo_tdef_vty_show_cmd(struct vty *vty, struct osmo_tdef *tdefs, const char *T_arg,
51 const char *prefix_fmt, ...);
52void osmo_tdef_vty_write(struct vty *vty, struct osmo_tdef *tdefs,
53 const char *prefix_fmt, ...);
54
55void osmo_tdef_vty_out_one(struct vty *vty, struct osmo_tdef *t, const char *prefix_fmt, ...);
56void osmo_tdef_vty_out_all(struct vty *vty, struct osmo_tdef *tdefs, const char *prefix_fmt, ...);
57
58void osmo_tdef_vty_out_one_va(struct vty *vty, struct osmo_tdef *t, const char *prefix_fmt, va_list va);
59void osmo_tdef_vty_out_all_va(struct vty *vty, struct osmo_tdef *tdefs, const char *prefix_fmt, va_list va);
60
61struct osmo_tdef *osmo_tdef_vty_parse_T_arg(struct vty *vty, struct osmo_tdef *tdefs, const char *osmo_tdef_str);
62unsigned long osmo_tdef_vty_parse_val_arg(const char *val_arg, unsigned long default_val);
63
64void osmo_tdef_vty_groups_init(enum node_type parent_node, struct osmo_tdef_group *groups);
65void osmo_tdef_vty_groups_write(struct vty *vty, const char *indent);
66
67/*! @} */