IPXNET.H 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /*
  2. Copyright (C) 1994-1995 Apogee Software, Ltd.
  3. This program is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU General Public License
  5. as published by the Free Software Foundation; either version 2
  6. of the License, or (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. See the GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  14. */
  15. // ipxnet.h
  16. #include "c:\merge\rottnet.h"
  17. typedef struct
  18. {
  19. char private[MAXPACKETSIZE];
  20. } rottdata_t;
  21. #include "global.h"
  22. //===========================================================================
  23. #define NUMPACKETS 8 // max outstanding packets before loss
  24. #define NUMPACKETSPERPLAYER 3 // max outstanding packets per player before loss
  25. #define MAXPACKETS (8*NUMPACKETSPERPLAYER)
  26. // setupdata_t is used as rottdata_t during setup
  27. typedef struct
  28. {
  29. short client;
  30. short playernumber;
  31. short command;
  32. short extra;
  33. short numplayers;
  34. } setupdata_t;
  35. typedef struct IPXPacketStructure
  36. {
  37. WORD PacketCheckSum; /* high-low */
  38. WORD PacketLength; /* high-low */
  39. BYTE PacketTransportControl;
  40. BYTE PacketType;
  41. BYTE dNetwork[4]; /* high-low */
  42. BYTE dNode[6]; /* high-low */
  43. BYTE dSocket[2]; /* high-low */
  44. BYTE sNetwork[4]; /* high-low */
  45. BYTE sNode[6]; /* high-low */
  46. BYTE sSocket[2]; /* high-low */
  47. } IPXPacket;
  48. typedef struct
  49. {
  50. BYTE network[4]; /* high-low */
  51. BYTE node[6]; /* high-low */
  52. } localadr_t;
  53. typedef struct
  54. {
  55. BYTE node[6]; /* high-low */
  56. } nodeadr_t;
  57. typedef struct ECBStructure
  58. {
  59. WORD Link[2]; /* offset-segment */
  60. WORD ESRAddress[2]; /* offset-segment */
  61. BYTE InUseFlag;
  62. BYTE CompletionCode;
  63. WORD ECBSocket; /* high-low */
  64. BYTE IPXWorkspace[4]; /* N/A */
  65. BYTE DriverWorkspace[12]; /* N/A */
  66. BYTE ImmediateAddress[6]; /* high-low */
  67. WORD FragmentCount; /* low-high */
  68. WORD fAddress[2]; /* offset-segment */
  69. WORD fSize; /* low-high */
  70. WORD f2Address[2]; /* offset-segment */
  71. WORD f2Size; /* low-high */
  72. } ECB;
  73. // time is used by the communication driver to sequence packets returned
  74. // to rott when more than one is waiting
  75. typedef struct
  76. {
  77. ECB ecb;
  78. IPXPacket ipx;
  79. long time;
  80. rottdata_t data;
  81. } packet_t;
  82. extern nodeadr_t nodeadr[MAXNETNODES+1];
  83. extern int localnodenum;
  84. extern long ipxlocaltime; // for time stamp in packets
  85. extern long remotetime; // timestamp of last packet gotten
  86. extern nodeadr_t remoteadr;
  87. void InitNetwork (void);
  88. void ShutdownNetwork (void);
  89. void SendPacket (int destination);
  90. int GetPacket (void);