route.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /****************************************************************************
  2. ******* *******
  3. ******* R O U T E H E A D E R
  4. ******* *******
  5. ****************************************************************************
  6. Author : Ian Nandhra / Jeremy Rolls
  7. Date :
  8. *
  9. * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License as published by
  13. * the Free Software Foundation; either version 2 of the License, or
  14. * (at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; if not, write to the Free Software
  23. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  24. Version : 0.01
  25. Mods
  26. ----------------------------------------------------------------------------
  27. Date By Description
  28. ----------------------------------------------------------------------------
  29. ***************************************************************************/
  30. #ifndef _route_h
  31. #define _route_h
  32. #define MAX_LINKS 4
  33. #define MAX_NODES 17 /* Maximum nodes in a subnet */
  34. #define NODE_BYTES ((MAX_NODES / 8) + 1) /* Number of bytes needed for
  35. 1 bit per node */
  36. #define ROUTE_DATA_SIZE (NODE_BYTES + 2) /* Number of bytes for complete
  37. info about cost etc. */
  38. #define ROUTES_PER_PACKET ((PKT_MAX_DATA_LEN -2)/ ROUTE_DATA_SIZE)
  39. /* Number of nodes we can squeeze
  40. into one packet */
  41. #define MAX_TOPOLOGY_PACKETS (MAX_NODES / ROUTES_PER_PACKET + 1)
  42. /************************************************
  43. * Define the types of command for the ROUTE RUP.
  44. ************************************************/
  45. #define ROUTE_REQUEST 0 /* Request an ID */
  46. #define ROUTE_FOAD 1 /* Kill the RTA */
  47. #define ROUTE_ALREADY 2 /* ID given already */
  48. #define ROUTE_USED 3 /* All ID's used */
  49. #define ROUTE_ALLOCATE 4 /* Here it is */
  50. #define ROUTE_REQ_TOP 5 /* I bet you didn't expect....
  51. the Topological Inquisition */
  52. #define ROUTE_TOPOLOGY 6 /* Topology request answered FD */
  53. /*******************************************************************
  54. * Define the Route Map Structure
  55. *
  56. * The route map gives a pointer to a Link Structure to use.
  57. * This allows Disconnected Links to be checked quickly
  58. ******************************************************************/
  59. typedef struct COST_ROUTE COST_ROUTE;
  60. struct COST_ROUTE {
  61. unsigned char cost; /* Cost down this link */
  62. unsigned char route[NODE_BYTES]; /* Nodes thorough this route */
  63. };
  64. typedef struct ROUTE_STR ROUTE_STR;
  65. struct ROUTE_STR {
  66. COST_ROUTE cost_route[MAX_LINKS];
  67. /* cost / route for this link */
  68. ushort favoured; /* favoured link */
  69. };
  70. #define NO_LINK (short) 5 /* Link unattached */
  71. #define ROUTE_NO_ID (short) 100 /* No Id */
  72. #define ROUTE_DISCONNECT (ushort) 0xff /* Not connected */
  73. #define ROUTE_INTERCONNECT (ushort) 0x40 /* Sub-net interconnect */
  74. #define SYNC_RUP (ushort) 255
  75. #define COMMAND_RUP (ushort) 254
  76. #define ERROR_RUP (ushort) 253
  77. #define POLL_RUP (ushort) 252
  78. #define BOOT_RUP (ushort) 251
  79. #define ROUTE_RUP (ushort) 250
  80. #define STATUS_RUP (ushort) 249
  81. #define POWER_RUP (ushort) 248
  82. #define HIGHEST_RUP (ushort) 255 /* Set to Top one */
  83. #define LOWEST_RUP (ushort) 248 /* Set to bottom one */
  84. #endif
  85. /*********** end of file ***********/