]> git.proxmox.com Git - mirror_frr.git/blob - isisd/isis_misc.h
Merge pull request #900 from qlyoung/apply-mask
[mirror_frr.git] / isisd / isis_misc.h
1 /*
2 * IS-IS Rout(e)ing protocol - isis_misc.h
3 * Miscellanous routines
4 *
5 * Copyright (C) 2001,2002 Sampo Saaristo
6 * Tampere University of Technology
7 * Institute of Communications Engineering
8 *
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)
12 * any later version.
13 *
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
17 * more details.
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
22 */
23
24 #ifndef _ZEBRA_ISIS_MISC_H
25 #define _ZEBRA_ISIS_MISC_H
26
27 int string2circuit_t(const char *);
28 const char *circuit_t2string(int);
29 const char *circuit_state2string(int state);
30 const char *circuit_type2string(int type);
31 const char *syst2string(int);
32 struct in_addr newprefix2inaddr(u_char *prefix_start, u_char prefix_masklen);
33 /*
34 * Converting input to memory stored format
35 * return value of 0 indicates wrong input
36 */
37 int dotformat2buff(u_char *, const char *);
38 int sysid2buff(u_char *, const char *);
39
40 /*
41 * Printing functions
42 */
43 const char *isonet_print(const u_char *, int len);
44 const char *sysid_print(const u_char *);
45 const char *snpa_print(const u_char *);
46 const char *rawlspid_print(const u_char *);
47 const char *isis_format_id(const uint8_t *id, size_t len);
48 const char *time2string(u_int32_t);
49 const char *nlpid2str(uint8_t nlpid);
50 /* typedef struct nlpids nlpids; */
51 char *nlpid2string(struct nlpids *);
52 const char *print_sys_hostname(const u_char *sysid);
53 void zlog_dump_data(void *data, int len);
54
55 /*
56 * misc functions
57 */
58 unsigned long isis_jitter(unsigned long timer, unsigned long jitter);
59 const char *unix_hostname(void);
60
61 /*
62 * macros
63 */
64 #define GETSYSID(A) \
65 (A->area_addr + (A->addr_len - (ISIS_SYS_ID_LEN + ISIS_NSEL_LEN)))
66
67 /* used for calculating nice string representation instead of plain seconds */
68
69 #define SECS_PER_MINUTE 60
70 #define SECS_PER_HOUR 3600
71 #define SECS_PER_DAY 86400
72 #define SECS_PER_WEEK 604800
73 #define SECS_PER_MONTH 2628000
74 #define SECS_PER_YEAR 31536000
75
76 enum { ISIS_UI_LEVEL_BRIEF,
77 ISIS_UI_LEVEL_DETAIL,
78 ISIS_UI_LEVEL_EXTENSIVE,
79 };
80
81 #include "lib/log.h"
82 void log_multiline(int priority, const char *prefix, const char *format, ...)
83 PRINTF_ATTRIBUTE(3, 4);
84 struct vty;
85 void vty_multiline(struct vty *vty, const char *prefix, const char *format, ...)
86 PRINTF_ATTRIBUTE(3, 4);
87 #endif