]>
Commit | Line | Data |
---|---|---|
acddc0ed | 1 | // SPDX-License-Identifier: GPL-2.0-or-later |
eb5d44eb | 2 | /* |
3 | * IS-IS Rout(e)ing protocol - isis_misc.h | |
4 | * Miscellanous routines | |
5 | * | |
6 | * Copyright (C) 2001,2002 Sampo Saaristo | |
d62a17ae | 7 | * Tampere University of Technology |
eb5d44eb | 8 | * Institute of Communications Engineering |
eb5d44eb | 9 | */ |
10 | ||
11 | #ifndef _ZEBRA_ISIS_MISC_H | |
12 | #define _ZEBRA_ISIS_MISC_H | |
13 | ||
d62a17ae | 14 | int string2circuit_t(const char *); |
15 | const char *circuit_t2string(int); | |
16 | const char *circuit_state2string(int state); | |
17 | const char *circuit_type2string(int type); | |
18 | const char *syst2string(int); | |
e36ec6ac | 19 | const char *isis_hello_padding2string(int hello_padding_type); |
d7c0a89a | 20 | struct in_addr newprefix2inaddr(uint8_t *prefix_start, uint8_t prefix_masklen); |
eb5d44eb | 21 | /* |
22 | * Converting input to memory stored format | |
23 | * return value of 0 indicates wrong input | |
24 | */ | |
d7c0a89a QY |
25 | int dotformat2buff(uint8_t *, const char *); |
26 | int sysid2buff(uint8_t *, const char *); | |
eb5d44eb | 27 | |
28 | /* | |
29 | * Printing functions | |
30 | */ | |
d7c0a89a | 31 | const char *time2string(uint32_t); |
9879e291 | 32 | const char *nlpid2str(uint8_t nlpid); |
eb5d44eb | 33 | /* typedef struct nlpids nlpids; */ |
d62a17ae | 34 | char *nlpid2string(struct nlpids *); |
36944791 | 35 | const char *print_sys_hostname(const uint8_t *sysid); |
d62a17ae | 36 | void zlog_dump_data(void *data, int len); |
eb5d44eb | 37 | |
eb5d44eb | 38 | /* |
39 | * misc functions | |
40 | */ | |
d62a17ae | 41 | unsigned long isis_jitter(unsigned long timer, unsigned long jitter); |
eb5d44eb | 42 | |
43 | /* | |
44 | * macros | |
45 | */ | |
d62a17ae | 46 | #define GETSYSID(A) \ |
47 | (A->area_addr + (A->addr_len - (ISIS_SYS_ID_LEN + ISIS_NSEL_LEN))) | |
eb5d44eb | 48 | |
eb5d44eb | 49 | /* used for calculating nice string representation instead of plain seconds */ |
50 | ||
51 | #define SECS_PER_MINUTE 60 | |
52 | #define SECS_PER_HOUR 3600 | |
53 | #define SECS_PER_DAY 86400 | |
54 | #define SECS_PER_WEEK 604800 | |
55 | #define SECS_PER_MONTH 2628000 | |
56 | #define SECS_PER_YEAR 31536000 | |
57 | ||
d62a17ae | 58 | enum { ISIS_UI_LEVEL_BRIEF, |
59 | ISIS_UI_LEVEL_DETAIL, | |
60 | ISIS_UI_LEVEL_EXTENSIVE, | |
eb5d44eb | 61 | }; |
62 | ||
9879e291 CF |
63 | #include "lib/log.h" |
64 | void log_multiline(int priority, const char *prefix, const char *format, ...) | |
afb35622 | 65 | PRINTFRR(3, 4); |
9cd06cd7 | 66 | char *log_uptime(time_t uptime, char *buf, size_t nbuf); |
9879e291 CF |
67 | struct vty; |
68 | void vty_multiline(struct vty *vty, const char *prefix, const char *format, ...) | |
afb35622 | 69 | PRINTFRR(3, 4); |
02cd317e | 70 | void vty_out_timestr(struct vty *vty, time_t uptime); |
f390d2c7 | 71 | #endif |