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; if not, write to the Free Software Foundation, Inc.,
21  * 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22  */
23 
24 #ifndef _ISIS_MISC_H_
25 #define _ISIS_MISC_H_
26 
27 /* includes */
28 #include <sys/utsname.h>
29 
30 /* defines */
31 
32 /* Host configuration variable */
33 struct host
34 {
35   /* Host name of this router. */
36   char *name;
37 
38   /* Password for vty interface. */
39   char *password;
40   char *password_encrypt;
41 
42   /* Enable password */
43   char *enable;
44   char *enable_encrypt;
45 
46   /* System wide terminal lines. */
47   int lines;
48 
49   /* Log filename. */
50   char *logfile;
51 
52   /* config file name of this host */
53   char *config;
54 
55   /* Flags for services */
56   int advanced;
57   int encrypt;
58 
59   /* Banner configuration. */
60   const char *motd;
61   char *motdfile;
62 };
63 
64 /* prototypes */
65 extern const char *circuit_t2string (int);
66 extern const char *syst2string (int);
67 extern struct in_addr newprefix2inaddr (u_char *, u_char);
68 extern int dotformat2buff (char *, const char *);
69 extern int sysid2buff (char *, const char *);
70 extern const char *isonet_print (u_char *, int);
71 extern const char *sysid_print (u_char *);
72 extern const char *snpa_print (u_char *);
73 extern const char *rawlspid_print (u_char *);
74 extern const char *time2string (u_int32_t);
75 extern char *nlpid2string (struct nlpids *);
76 extern int speaks (struct nlpids *, int);
77 extern unsigned long isis_jitter (unsigned long, unsigned long);
78 extern const char *unix_hostname (void);
79 
80 /*
81  * macros
82  */
83 #define GETSYSID(A,L) (A->area_addr + (A->addr_len - (L + 1)))
84 
85 /* used for calculating nice string representation instead of plain seconds */
86 
87 #define SECS_PER_MINUTE 60
88 #define SECS_PER_HOUR   3600
89 #define SECS_PER_DAY    86400
90 #define SECS_PER_WEEK   604800
91 #define SECS_PER_MONTH  2628000
92 #define SECS_PER_YEAR   31536000
93 
94 enum
95 {
96   ISIS_UI_LEVEL_BRIEF,
97   ISIS_UI_LEVEL_DETAIL,
98   ISIS_UI_LEVEL_EXTENSIVE,
99 };
100 
101 #endif /* _ISIS_MISC_H_ */
102