From eb5d44eb8dcf25a1b328e57d1eabb1f89e3bc59b Mon Sep 17 00:00:00 2001 From: jardin Date: Tue, 23 Dec 2003 08:09:43 +0000 Subject: Initial revision --- isisd/isis_misc.h | 94 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 isisd/isis_misc.h (limited to 'isisd/isis_misc.h') diff --git a/isisd/isis_misc.h b/isisd/isis_misc.h new file mode 100644 index 00000000..0e219c65 --- /dev/null +++ b/isisd/isis_misc.h @@ -0,0 +1,94 @@ +/* + * IS-IS Rout(e)ing protocol - isis_misc.h + * Miscellanous routines + * + * Copyright (C) 2001,2002 Sampo Saaristo + * Tampere University of Technology + * Institute of Communications Engineering + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public Licenseas published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful,but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _ZEBRA_ISIS_MISC_H +#define _ZEBRA_ISIS_MISC_H + +int dotformat2buff (u_char *, u_char *); +int string2circuit_t (u_char *); +const char *circuit_t2string (int); +const char *syst2string (int); +struct in_addr newprefix2inaddr (u_char *prefix_start, u_char prefix_masklen); +/* + * Converting input to memory stored format + * return value of 0 indicates wrong input + */ +int dotformat2buff (u_char *, u_char *); +int sysid2buff (u_char *, u_char *); + +/* + * Printing functions + */ +char *isonet_print (u_char *, int len); +char *sysid_print (u_char *); +char *snpa_print (u_char *); +char *rawlspid_print (u_char *); +char *time2string (u_int32_t); +/* typedef struct nlpids nlpids; */ +char *nlpid2string (struct nlpids *); + + +/* + * misc functions + */ +int speaks (struct nlpids *nlpids, int family); +unsigned long isis_jitter (unsigned long timer, unsigned long jitter); + +/* + * macros + */ +#define GETSYSID(A,L) (A->area_addr + (A->addr_len - (L + 1))) + + +/* staticly assigned vars for printing purposes */ +struct in_addr new_prefix; +/* len of xxxx.xxxx.xxxx + place for #0 termination */ +char sysid[15]; +/* len of xxxx.xxxx.xxxx + place for #0 termination */ +char snpa[15]; +/* len of xx.xxxx.xxxx.xxxx.xxxx.xxxx.xxxx.xxxx.xxxx.xxxx.xx */ +char isonet[51]; +/* + place for #0 termination */ +/* len of xxxx.xxxx.xxxx.xx.xx + place for #0 termination */ +char lspid[21]; +/* len of xxYxxMxWxdxxhxxmxxs + place for #0 termination */ +char datestring[20]; +char nlpidstring[30]; + +/* used for calculating nice string representation instead of plain seconds */ + +#define SECS_PER_MINUTE 60 +#define SECS_PER_HOUR 3600 +#define SECS_PER_DAY 86400 +#define SECS_PER_WEEK 604800 +#define SECS_PER_MONTH 2628000 +#define SECS_PER_YEAR 31536000 + +enum { + ISIS_UI_LEVEL_BRIEF, + ISIS_UI_LEVEL_DETAIL, + ISIS_UI_LEVEL_EXTENSIVE, +}; + + +#endif -- cgit v1.2.1