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