blob: 3027913df08b45e911586c4844a54b48664c827f [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
Harald Welte581a34d2019-05-27 23:15:28 +020011 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
Neels Hofmeyr0fd615f2019-01-26 20:36:12 +010013 * (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
Harald Welte581a34d2019-05-27 23:15:28 +020018 * GNU General Public License for more details.
Neels Hofmeyr0fd615f2019-01-26 20:36:12 +010019 *
Harald Welte581a34d2019-05-27 23:15:28 +020020 * You should have received a copy of the GNU General Public License
Neels Hofmeyr0fd615f2019-01-26 20:36:12 +010021 * along with this program. If not, see <http://www.gnu.org/licenses/>.
Harald Welte581a34d2019-05-27 23:15:28 +020022 *
23 * SPDX-License-Identifier: GPL-2.0+
Neels Hofmeyr0fd615f2019-01-26 20:36:12 +010024 */
25#pragma once
26
27#include <stdint.h>
28
29struct vty;
30
31/*! \defgroup Tdef_VTY Tnnn timer VTY configuration
32 * @{
33 * \file tdef_vty.h
34 */
35
36struct osmo_tdef;
37struct osmo_tdef_group;
38
39#define OSMO_TDEF_VTY_ARG_T "TNNNN"
Neels Hofmeyr5734bff2019-02-21 02:27:48 +010040#define OSMO_TDEF_VTY_DOC_T \
41 "T- or X-timer-number -- 3GPP compliant timer number of the format '1234' or 'T1234' or 't1234';" \
42 " Osmocom-specific timer number of the format: 'X1234' or 'x1234'.\n"
Neels Hofmeyr0fd615f2019-01-26 20:36:12 +010043#define OSMO_TDEF_VTY_ARG_T_OPTIONAL "[" OSMO_TDEF_VTY_ARG_T "]"
44
45#define OSMO_TDEF_VTY_ARG_VAL "(<0-2147483647>|default)"
46#define OSMO_TDEF_VTY_DOC_VAL "New timer value\n" "Set to default timer value\n"
47#define OSMO_TDEF_VTY_ARG_VAL_OPTIONAL "[" OSMO_TDEF_VTY_ARG_VAL "]"
48
49#define OSMO_TDEF_VTY_ARG_SET OSMO_TDEF_VTY_ARG_T " " OSMO_TDEF_VTY_ARG_VAL
50#define OSMO_TDEF_VTY_DOC_SET OSMO_TDEF_VTY_DOC_T OSMO_TDEF_VTY_DOC_VAL
51#define OSMO_TDEF_VTY_ARG_SET_OPTIONAL OSMO_TDEF_VTY_ARG_T_OPTIONAL " " OSMO_TDEF_VTY_ARG_VAL_OPTIONAL
52
53int osmo_tdef_vty_set_cmd(struct vty *vty, struct osmo_tdef *tdefs, const char **args);
54int osmo_tdef_vty_show_cmd(struct vty *vty, struct osmo_tdef *tdefs, const char *T_arg,
55 const char *prefix_fmt, ...);
56void osmo_tdef_vty_write(struct vty *vty, struct osmo_tdef *tdefs,
57 const char *prefix_fmt, ...);
58
59void osmo_tdef_vty_out_one(struct vty *vty, struct osmo_tdef *t, const char *prefix_fmt, ...);
60void osmo_tdef_vty_out_all(struct vty *vty, struct osmo_tdef *tdefs, const char *prefix_fmt, ...);
61
62void osmo_tdef_vty_out_one_va(struct vty *vty, struct osmo_tdef *t, const char *prefix_fmt, va_list va);
63void osmo_tdef_vty_out_all_va(struct vty *vty, struct osmo_tdef *tdefs, const char *prefix_fmt, va_list va);
64
65struct osmo_tdef *osmo_tdef_vty_parse_T_arg(struct vty *vty, struct osmo_tdef *tdefs, const char *osmo_tdef_str);
66unsigned long osmo_tdef_vty_parse_val_arg(const char *val_arg, unsigned long default_val);
67
68void osmo_tdef_vty_groups_init(enum node_type parent_node, struct osmo_tdef_group *groups);
69void osmo_tdef_vty_groups_write(struct vty *vty, const char *indent);
70
71/*! @} */