blob: 800af7d7b2af0ca53f26053854f6c8a70f37d8c5 [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>
Pau Espin Pedrol097b5092019-09-05 13:49:05 +020028#include <stdarg.h>
29
30#include <osmocom/vty/command.h>
Neels Hofmeyr0fd615f2019-01-26 20:36:12 +010031
32struct vty;
33
34/*! \defgroup Tdef_VTY Tnnn timer VTY configuration
35 * @{
36 * \file tdef_vty.h
37 */
38
39struct osmo_tdef;
40struct osmo_tdef_group;
41
42#define OSMO_TDEF_VTY_ARG_T "TNNNN"
Neels Hofmeyr5734bff2019-02-21 02:27:48 +010043#define OSMO_TDEF_VTY_DOC_T \
44 "T- or X-timer-number -- 3GPP compliant timer number of the format '1234' or 'T1234' or 't1234';" \
45 " Osmocom-specific timer number of the format: 'X1234' or 'x1234'.\n"
Neels Hofmeyr0fd615f2019-01-26 20:36:12 +010046#define OSMO_TDEF_VTY_ARG_T_OPTIONAL "[" OSMO_TDEF_VTY_ARG_T "]"
47
48#define OSMO_TDEF_VTY_ARG_VAL "(<0-2147483647>|default)"
49#define OSMO_TDEF_VTY_DOC_VAL "New timer value\n" "Set to default timer value\n"
50#define OSMO_TDEF_VTY_ARG_VAL_OPTIONAL "[" OSMO_TDEF_VTY_ARG_VAL "]"
51
52#define OSMO_TDEF_VTY_ARG_SET OSMO_TDEF_VTY_ARG_T " " OSMO_TDEF_VTY_ARG_VAL
53#define OSMO_TDEF_VTY_DOC_SET OSMO_TDEF_VTY_DOC_T OSMO_TDEF_VTY_DOC_VAL
54#define OSMO_TDEF_VTY_ARG_SET_OPTIONAL OSMO_TDEF_VTY_ARG_T_OPTIONAL " " OSMO_TDEF_VTY_ARG_VAL_OPTIONAL
55
56int osmo_tdef_vty_set_cmd(struct vty *vty, struct osmo_tdef *tdefs, const char **args);
57int osmo_tdef_vty_show_cmd(struct vty *vty, struct osmo_tdef *tdefs, const char *T_arg,
58 const char *prefix_fmt, ...);
59void osmo_tdef_vty_write(struct vty *vty, struct osmo_tdef *tdefs,
60 const char *prefix_fmt, ...);
61
62void osmo_tdef_vty_out_one(struct vty *vty, struct osmo_tdef *t, const char *prefix_fmt, ...);
63void osmo_tdef_vty_out_all(struct vty *vty, struct osmo_tdef *tdefs, const char *prefix_fmt, ...);
64
65void osmo_tdef_vty_out_one_va(struct vty *vty, struct osmo_tdef *t, const char *prefix_fmt, va_list va);
66void osmo_tdef_vty_out_all_va(struct vty *vty, struct osmo_tdef *tdefs, const char *prefix_fmt, va_list va);
67
68struct osmo_tdef *osmo_tdef_vty_parse_T_arg(struct vty *vty, struct osmo_tdef *tdefs, const char *osmo_tdef_str);
69unsigned long osmo_tdef_vty_parse_val_arg(const char *val_arg, unsigned long default_val);
70
Vadim Yanitskiydf4f6082020-01-25 09:49:22 +070071void osmo_tdef_vty_groups_init(unsigned int parent_cfg_node, struct osmo_tdef_group *groups);
Neels Hofmeyr0fd615f2019-01-26 20:36:12 +010072void osmo_tdef_vty_groups_write(struct vty *vty, const char *indent);
73
74/*! @} */