blob: ca0c0ae3b563f2af1e4c37982ad398712c59842c [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
27int dotformat2buff (u_char *, u_char *);
28int string2circuit_t (u_char *);
29const char *circuit_t2string (int);
30const char *syst2string (int);
31struct in_addr newprefix2inaddr (u_char *prefix_start, u_char prefix_masklen);
32/*
33 * Converting input to memory stored format
34 * return value of 0 indicates wrong input
35 */
36int dotformat2buff (u_char *, u_char *);
37int sysid2buff (u_char *, u_char *);
38
39/*
40 * Printing functions
41 */
42char *isonet_print (u_char *, int len);
43char *sysid_print (u_char *);
44char *snpa_print (u_char *);
45char *rawlspid_print (u_char *);
46char *time2string (u_int32_t);
47/* typedef struct nlpids nlpids; */
48char *nlpid2string (struct nlpids *);
49
50
51/*
52 * misc functions
53 */
54int speaks (struct nlpids *nlpids, int family);
55unsigned long isis_jitter (unsigned long timer, unsigned long jitter);
jardin9e867fe2003-12-23 08:56:18 +000056const char * unix_hostname(void);
57
jardineb5d44e2003-12-23 08:09:43 +000058
59/*
60 * macros
61 */
62#define GETSYSID(A,L) (A->area_addr + (A->addr_len - (L + 1)))
63
64
65/* staticly assigned vars for printing purposes */
66struct in_addr new_prefix;
67/* len of xxxx.xxxx.xxxx + place for #0 termination */
68char sysid[15];
69/* len of xxxx.xxxx.xxxx + place for #0 termination */
70char snpa[15];
71/* len of xx.xxxx.xxxx.xxxx.xxxx.xxxx.xxxx.xxxx.xxxx.xxxx.xx */
72char isonet[51];
73/* + place for #0 termination */
74/* len of xxxx.xxxx.xxxx.xx.xx + place for #0 termination */
75char lspid[21];
76/* len of xxYxxMxWxdxxhxxmxxs + place for #0 termination */
77char datestring[20];
78char nlpidstring[30];
79
80/* used for calculating nice string representation instead of plain seconds */
81
82#define SECS_PER_MINUTE 60
83#define SECS_PER_HOUR 3600
84#define SECS_PER_DAY 86400
85#define SECS_PER_WEEK 604800
86#define SECS_PER_MONTH 2628000
87#define SECS_PER_YEAR 31536000
88
89enum {
90 ISIS_UI_LEVEL_BRIEF,
91 ISIS_UI_LEVEL_DETAIL,
92 ISIS_UI_LEVEL_EXTENSIVE,
93};
94
95
96#endif