isis_misc.h 2.9 KB

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