blob: 9f30e204ff1d62caf9199e6cc0f4e7bdcf2060a4 [file] [log] [blame]
paul718e3742002-12-13 20:15:29 +00001/* OSPF VTY interface.
2 * Copyright (C) 2000 Toshiaki Takada
3 *
4 * This file is part of GNU Zebra.
5 *
6 * GNU Zebra is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2, or (at your option) any
9 * later version.
10 *
11 * GNU Zebra is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with GNU Zebra; see the file COPYING. If not, write to the Free
18 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19 * 02111-1307, USA.
20 */
21
22/* Macros. */
23#define VTY_GET_UINT32(NAME,V,STR) \
24{ \
25 char *endptr = NULL; \
26 (V) = strtoul ((STR), &endptr, 10); \
27 if (*endptr != '\0' || ((V) == ULONG_MAX && errno == ERANGE)) \
28 { \
29 vty_out (vty, "%% Invalid %s value%s", NAME, VTY_NEWLINE); \
30 return CMD_WARNING; \
31 } \
32}
33
34#define VTY_GET_IPV4_ADDRESS(NAME,V,STR) \
35{ \
36 int retv; \
37 retv = inet_aton ((STR), &(V)); \
38 if (!retv) \
39 { \
40 vty_out (vty, "%% Invalid %s value%s", NAME, VTY_NEWLINE); \
41 return CMD_WARNING; \
42 } \
43}
44
45#define VTY_GET_IPV4_PREFIX(NAME,V,STR) \
46{ \
47 int retv; \
48 retv = str2prefix_ipv4 ((STR), &(V)); \
49 if (retv <= 0) \
50 { \
51 vty_out (vty, "%% Invalid %s value%s", NAME, VTY_NEWLINE); \
52 return CMD_WARNING; \
53 } \
54}
55
56#define VTY_GET_OSPF_AREA_ID(V,F,STR) \
57{ \
58 int retv; \
59 retv = ospf_str2area_id ((STR), &(V), &(F)); \
60 if (retv < 0) \
61 { \
62 vty_out (vty, "%% Invalid OSPF area ID%s", VTY_NEWLINE); \
63 return CMD_WARNING; \
64 } \
65}
66
67#define VTY_GET_OSPF_AREA_ID_NO_BB(NAME,V,F,STR) \
68{ \
69 int retv; \
70 retv = ospf_str2area_id ((STR), &(V), &(F)); \
71 if (retv < 0) \
72 { \
73 vty_out (vty, "%% Invalid OSPF area ID%s", VTY_NEWLINE); \
74 return CMD_WARNING; \
75 } \
76 if (OSPF_IS_AREA_ID_BACKBONE ((V))) \
77 { \
78 vty_out (vty, "%% You can't configure %s to backbone%s", \
79 NAME, VTY_NEWLINE); \
80 } \
81}
82
83/* Prototypes. */
84void ospf_vty_init ();
85void ospf_vty_show_init ();