pkt.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /****************************************************************************
  2. ******* *******
  3. ******* P A C K E T H E A D E R F I L E
  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 _pkt_h
  31. #define _pkt_h 1
  32. #ifdef SCCS_LABELS
  33. #ifndef lint
  34. /* static char *_rio_pkt_h_sccs = "@(#)pkt.h 1.8"; */
  35. #endif
  36. #endif
  37. #define MAX_TTL 0xf
  38. #define PKT_CMD_BIT ((ushort) 0x080)
  39. #define PKT_CMD_DATA ((ushort) 0x080)
  40. #define PKT_ACK ((ushort) 0x040)
  41. #define PKT_TGL ((ushort) 0x020)
  42. #define PKT_LEN_MASK ((ushort) 0x07f)
  43. #define DATA_WNDW ((ushort) 0x10)
  44. #define PKT_TTL_MASK ((ushort) 0x0f)
  45. #define PKT_MAX_DATA_LEN 72
  46. #define PKT_LENGTH sizeof(struct PKT)
  47. #define SYNC_PKT_LENGTH (PKT_LENGTH + 4)
  48. #define CONTROL_PKT_LEN_MASK PKT_LEN_MASK
  49. #define CONTROL_PKT_CMD_BIT PKT_CMD_BIT
  50. #define CONTROL_PKT_ACK (PKT_ACK << 8)
  51. #define CONTROL_PKT_TGL (PKT_TGL << 8)
  52. #define CONTROL_PKT_TTL_MASK (PKT_TTL_MASK << 8)
  53. #define CONTROL_DATA_WNDW (DATA_WNDW << 8)
  54. struct PKT {
  55. #ifdef INKERNEL
  56. BYTE dest_unit ; /* Destination Unit Id */
  57. BYTE dest_port ; /* Destination POrt */
  58. BYTE src_unit ; /* Source Unit Id */
  59. BYTE src_port ; /* Source POrt */
  60. #else
  61. union
  62. {
  63. ushort destination; /* Complete destination */
  64. struct
  65. {
  66. unsigned char unit; /* Destination unit */
  67. unsigned char port; /* Destination port */
  68. } s1;
  69. } u1;
  70. union
  71. {
  72. ushort source; /* Complete source */
  73. struct
  74. {
  75. unsigned char unit; /* Source unit */
  76. unsigned char port; /* Source port */
  77. } s2;
  78. } u2;
  79. #endif
  80. #ifdef INKERNEL
  81. BYTE len ;
  82. BYTE control;
  83. #else
  84. union
  85. {
  86. ushort control;
  87. struct
  88. {
  89. unsigned char len;
  90. unsigned char control;
  91. } s3;
  92. } u3;
  93. #endif
  94. BYTE data[PKT_MAX_DATA_LEN] ;
  95. /* Actual data :-) */
  96. WORD csum ; /* C-SUM */
  97. } ;
  98. #endif
  99. /*********** end of file ***********/