]> git.proxmox.com Git - mirror_frr.git/blame - isisd/isis_misc.h
lib: enforce vrf_name_to_id by returning default_vrf when name is null
[mirror_frr.git] / isisd / isis_misc.h
CommitLineData
eb5d44eb 1/*
2 * IS-IS Rout(e)ing protocol - isis_misc.h
3 * Miscellanous routines
4 *
5 * Copyright (C) 2001,2002 Sampo Saaristo
d62a17ae 6 * Tampere University of Technology
eb5d44eb 7 * Institute of Communications Engineering
8 *
d62a17ae 9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public Licenseas published by the Free
11 * Software Foundation; either version 2 of the License, or (at your option)
eb5d44eb 12 * any later version.
13 *
d62a17ae 14 * This program is distributed in the hope that it will be useful,but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
eb5d44eb 17 * more details.
896014f4
DL
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; see the file COPYING; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
eb5d44eb 22 */
23
24#ifndef _ZEBRA_ISIS_MISC_H
25#define _ZEBRA_ISIS_MISC_H
26
d62a17ae 27int string2circuit_t(const char *);
28const char *circuit_t2string(int);
29const char *circuit_state2string(int state);
30const char *circuit_type2string(int type);
31const char *syst2string(int);
d7c0a89a 32struct in_addr newprefix2inaddr(uint8_t *prefix_start, uint8_t prefix_masklen);
eb5d44eb 33/*
34 * Converting input to memory stored format
35 * return value of 0 indicates wrong input
36 */
d7c0a89a
QY
37int dotformat2buff(uint8_t *, const char *);
38int sysid2buff(uint8_t *, const char *);
eb5d44eb 39
40/*
41 * Printing functions
42 */
d7c0a89a
QY
43const char *isonet_print(const uint8_t *, int len);
44const char *sysid_print(const uint8_t *);
45const char *snpa_print(const uint8_t *);
46const char *rawlspid_print(const uint8_t *);
9879e291 47const char *isis_format_id(const uint8_t *id, size_t len);
d7c0a89a 48const char *time2string(uint32_t);
9879e291 49const char *nlpid2str(uint8_t nlpid);
eb5d44eb 50/* typedef struct nlpids nlpids; */
d62a17ae 51char *nlpid2string(struct nlpids *);
d7c0a89a 52const char *print_sys_hostname(const uint8_t *sysid);
d62a17ae 53void zlog_dump_data(void *data, int len);
eb5d44eb 54
eb5d44eb 55/*
56 * misc functions
57 */
d62a17ae 58unsigned long isis_jitter(unsigned long timer, unsigned long jitter);
eb5d44eb 59
60/*
61 * macros
62 */
d62a17ae 63#define GETSYSID(A) \
64 (A->area_addr + (A->addr_len - (ISIS_SYS_ID_LEN + ISIS_NSEL_LEN)))
eb5d44eb 65
eb5d44eb 66/* used for calculating nice string representation instead of plain seconds */
67
68#define SECS_PER_MINUTE 60
69#define SECS_PER_HOUR 3600
70#define SECS_PER_DAY 86400
71#define SECS_PER_WEEK 604800
72#define SECS_PER_MONTH 2628000
73#define SECS_PER_YEAR 31536000
74
d62a17ae 75enum { ISIS_UI_LEVEL_BRIEF,
76 ISIS_UI_LEVEL_DETAIL,
77 ISIS_UI_LEVEL_EXTENSIVE,
eb5d44eb 78};
79
9879e291
CF
80#include "lib/log.h"
81void log_multiline(int priority, const char *prefix, const char *format, ...)
82 PRINTF_ATTRIBUTE(3, 4);
83struct vty;
84void vty_multiline(struct vty *vty, const char *prefix, const char *format, ...)
85 PRINTF_ATTRIBUTE(3, 4);
02cd317e 86void vty_out_timestr(struct vty *vty, time_t uptime);
f390d2c7 87#endif