source: abuse/branches/pd/imlib/port/dos4gw/ipx.hpp @ 528

Last change on this file since 528 was 49, checked in by Sam Hocevar, 15 years ago
  • Imported original public domain release, for future reference.
File size: 2.4 KB
Line 
1#ifndef __IPX_HHP__
2#define __IPX_HHP__
3
4#include "jnet.hpp"
5#define MAX_PACKETS 10
6
7#pragma pack (1)
8
9struct ECBStructure
10{
11  ushort Link[2];                /* offset-segment */
12  ushort ESRAddress[2];          /* offset-segment */
13  uchar  InUseFlag;
14  uchar  CompletionCode;
15  ushort ECBSocket;              /* high-low */
16  uchar  IPXWorkspace[4];        /* N/A */
17  uchar  DriverWorkspace[12];    /* N/A */
18  uchar  ImmediateAddress[6];    /* high-low */
19  ushort FragmentCount;          /* low-high */
20  ushort fAddress[2];            /* offset-segment */
21  ushort fSize;                  /* low-high */
22} ;
23
24struct IPXPacketStructure
25{
26  ushort PacketCheckSum;         /* high-low */
27  ushort PacketLength;           /* high-low */
28  uchar  PacketTransportControl;
29  uchar  PacketType;
30
31  uchar  dNetwork[4];            /* high-low */
32  uchar  dNode[6];               /* high-low */
33  ushort dSocket;                /* high-low */
34
35  uchar  sNetwork[4];            /* high-low */
36  uchar  sNode[6];               /* high-low */
37  ushort sSocket;                /* high-low */
38};
39
40
41struct JC_ipx_packet
42{
43  ECBStructure ecb;
44  IPXPacketStructure ipx;
45  ulong time_stamp;
46  ushort verify_stamp;       // should be 0cdc  "crack dot com", all others ignored
47  uchar buffer[512];
48} ;
49
50
51class ipx_out_socket : public out_socket
52{
53  public :
54
55  int local_socket,      // fetched dymnamically from IPX driver
56      remote_socket;     // fetched from remote host through connection port
57  ulong local_time,
58        remote_time;
59  JC_ipx_packet *pk;                        // list of ecb's
60  ipx_out_socket(int port);                 // port==0 means allocate dynamically
61                                            // allocates 1 sending ecb, and 5 recieving
62
63  int try_connect(char *rhost, int port);  // sends connection request to port and
64                                            // waits for a acceptance reply, 2 second time out
65  virtual int ready_to_read();              // true if at any "recieve" packets are clear
66  virtual int ready_to_write();             // true if send packet is clear
67  virtual int send(packet &pk);
68  virtual int get(packet &pk);             
69  virtual ~ipx_out_socket();
70} ;
71
72
73class ipx_in_socket : public in_socket
74{
75  int port;
76  public :
77  ipx_in_socket(int Port);
78  ipx_out_socket *listener;
79  virtual out_socket *check_for_connect();
80  virtual ~ipx_in_socket();
81} ;
82
83int ipx_init();
84void ipx_uninit();
85uchar *ipx_get_local_address();
86
87#endif
88
89
90
91
92
93
Note: See TracBrowser for help on using the repository browser.