isis_misc.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. * You should have received a copy of the GNU General Public License along
  19. * with this program; if not, write to the Free Software Foundation, Inc.,
  20. * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  21. */
  22. #ifndef _ZEBRA_ISIS_MISC_H
  23. #define _ZEBRA_ISIS_MISC_H
  24. int string2circuit_t (const char *);
  25. const char *circuit_t2string (int);
  26. const char *circuit_state2string (int state);
  27. const char *circuit_type2string (int type);
  28. const char *syst2string (int);
  29. struct in_addr newprefix2inaddr (u_char * prefix_start,
  30. u_char prefix_masklen);
  31. /*
  32. * Converting input to memory stored format
  33. * return value of 0 indicates wrong input
  34. */
  35. int dotformat2buff (u_char *, const char *);
  36. int sysid2buff (u_char *, const char *);
  37. /*
  38. * Printing functions
  39. */
  40. const char *isonet_print (const u_char *, int len);
  41. const char *sysid_print (const u_char *);
  42. const char *snpa_print (const u_char *);
  43. const char *rawlspid_print (const u_char *);
  44. const char *time2string (u_int32_t);
  45. /* typedef struct nlpids nlpids; */
  46. char *nlpid2string (struct nlpids *);
  47. const char *print_sys_hostname (const u_char *sysid);
  48. void zlog_dump_data (void *data, int len);
  49. /*
  50. * misc functions
  51. */
  52. int speaks (struct nlpids *nlpids, int family);
  53. unsigned long isis_jitter (unsigned long timer, unsigned long jitter);
  54. const char *unix_hostname (void);
  55. /*
  56. * macros
  57. */
  58. #define GETSYSID(A) (A->area_addr + (A->addr_len - \
  59. (ISIS_SYS_ID_LEN + ISIS_NSEL_LEN)))
  60. /* used for calculating nice string representation instead of plain seconds */
  61. #define SECS_PER_MINUTE 60
  62. #define SECS_PER_HOUR 3600
  63. #define SECS_PER_DAY 86400
  64. #define SECS_PER_WEEK 604800
  65. #define SECS_PER_MONTH 2628000
  66. #define SECS_PER_YEAR 31536000
  67. enum
  68. {
  69. ISIS_UI_LEVEL_BRIEF,
  70. ISIS_UI_LEVEL_DETAIL,
  71. ISIS_UI_LEVEL_EXTENSIVE,
  72. };
  73. #endif