blob: 0cd65a66ae5be1f00852a951f099c551fb37ab36 [file] [log] [blame]
jardineb5d44e2003-12-23 08:09:43 +00001/*
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; if not, write to the Free Software Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 */
23
24#ifndef _ZEBRA_ISIS_MISC_H
25#define _ZEBRA_ISIS_MISC_H
26
Josh Bailey3f045a02012-03-24 08:35:20 -070027int string2circuit_t (const char *);
jardineb5d44e2003-12-23 08:09:43 +000028const char *circuit_t2string (int);
Josh Bailey3f045a02012-03-24 08:35:20 -070029const char *circuit_state2string (int state);
30const char *circuit_type2string (int type);
jardineb5d44e2003-12-23 08:09:43 +000031const char *syst2string (int);
hassof390d2c2004-09-10 20:48:21 +000032struct in_addr newprefix2inaddr (u_char * prefix_start,
33 u_char prefix_masklen);
jardineb5d44e2003-12-23 08:09:43 +000034/*
35 * Converting input to memory stored format
36 * return value of 0 indicates wrong input
37 */
Josh Bailey3f045a02012-03-24 08:35:20 -070038int dotformat2buff (u_char *, const char *);
39int sysid2buff (u_char *, const char *);
jardineb5d44e2003-12-23 08:09:43 +000040
41/*
42 * Printing functions
43 */
hasso1cd80842004-10-07 20:07:40 +000044const char *isonet_print (u_char *, int len);
45const char *sysid_print (u_char *);
46const char *snpa_print (u_char *);
47const char *rawlspid_print (u_char *);
48const char *time2string (u_int32_t);
jardineb5d44e2003-12-23 08:09:43 +000049/* typedef struct nlpids nlpids; */
50char *nlpid2string (struct nlpids *);
Josh Bailey3f045a02012-03-24 08:35:20 -070051const char *print_sys_hostname (u_char *sysid);
52void zlog_dump_data (void *data, int len);
jardineb5d44e2003-12-23 08:09:43 +000053
jardineb5d44e2003-12-23 08:09:43 +000054/*
55 * misc functions
56 */
hassof390d2c2004-09-10 20:48:21 +000057int speaks (struct nlpids *nlpids, int family);
jardineb5d44e2003-12-23 08:09:43 +000058unsigned long isis_jitter (unsigned long timer, unsigned long jitter);
hassof390d2c2004-09-10 20:48:21 +000059const char *unix_hostname (void);
jardineb5d44e2003-12-23 08:09:43 +000060
61/*
62 * macros
63 */
Josh Bailey3f045a02012-03-24 08:35:20 -070064#define GETSYSID(A) (A->area_addr + (A->addr_len - \
65 (ISIS_SYS_ID_LEN + ISIS_NSEL_LEN)))
jardineb5d44e2003-12-23 08:09:43 +000066
jardineb5d44e2003-12-23 08:09:43 +000067/* 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
hassof390d2c2004-09-10 20:48:21 +000076enum
77{
jardineb5d44e2003-12-23 08:09:43 +000078 ISIS_UI_LEVEL_BRIEF,
79 ISIS_UI_LEVEL_DETAIL,
80 ISIS_UI_LEVEL_EXTENSIVE,
81};
82
hassof390d2c2004-09-10 20:48:21 +000083#endif