CnC_Remastered_Collection

Command and Conquer: Red Alert
Log | Files | Refs | README | LICENSE

IPX.H (8475B)


      1 //
      2 // Copyright 2020 Electronic Arts Inc.
      3 //
      4 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is free 
      5 // software: you can redistribute it and/or modify it under the terms of 
      6 // the GNU General Public License as published by the Free Software Foundation, 
      7 // either version 3 of the License, or (at your option) any later version.
      8 
      9 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed 
     10 // in the hope that it will be useful, but with permitted additional restrictions 
     11 // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT 
     12 // distributed with this program. You should have received a copy of the 
     13 // GNU General Public License along with permitted additional restrictions 
     14 // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
     15 
     16 /* $Header: /CounterStrike/IPX.H 1     3/03/97 10:24a Joe_bostic $ */
     17 /***************************************************************************
     18  **   C O N F I D E N T I A L --- W E S T W O O D    S T U D I O S        **
     19  ***************************************************************************
     20  *                                                                         *
     21  *                 Project Name : Command & Conquer                        *
     22  *                                                                         *
     23  *                    File Name : IPX.H                                    *
     24  *                                                                         *
     25  *                   Programmer : Barry Nance										*
     26  * 										 from Client/Server LAN Programming			*
     27  *											 Westwood-ized by Bill Randolph				*
     28  *                                                                         *
     29  *                   Start Date : December 14, 1994                        *
     30  *                                                                         *
     31  *                  Last Update : December 14, 1994   [BR]                 *
     32  *                                                                         *
     33  * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
     34 
     35 #ifndef IPX_H
     36 #define IPX_H
     37 
     38 /*
     39 ******************************** Structures *********************************
     40 */
     41 typedef unsigned char NetNumType[4];
     42 typedef unsigned char NetNodeType[6];
     43 typedef char UserID[48];
     44 
     45 /*---------------------------------------------------------------------------
     46 This is the IPX Packet structure.  It's followed by the data itself, which
     47 can be up to 546 bytes long.  Annotation of 'IPX' means IPX will set this
     48 field; annotation of 'APP' means the application must set the field.
     49 NOTE: All header fields are ordered high-byte,low-byte.
     50 ---------------------------------------------------------------------------*/
     51 typedef struct IPXHEADER {
     52 	unsigned short CheckSum;					// IPX: Not used; always 0xffff
     53 	unsigned short Length;						// IPX: Total size, incl header & data
     54 	unsigned char TransportControl;			// IPX: # bridges message crossed
     55 	unsigned char PacketType;					// APP: Set to 4 for IPX (5 for SPX)
     56 	unsigned char DestNetworkNumber[4];		// APP: destination Network Number
     57 	unsigned char DestNetworkNode[6];		// APP: destination Node Address
     58 	unsigned short DestNetworkSocket;		// APP: destination Socket Number
     59 	unsigned char SourceNetworkNumber[4];	// IPX: source Network Number
     60 	unsigned char SourceNetworkNode[6];		// IPX: source Node Address
     61 	unsigned short SourceNetworkSocket;		// IPX: source Socket Number
     62 } IPXHeaderType;
     63 
     64 /*---------------------------------------------------------------------------
     65 This is the IPX Event Control Block.  It serves as a communications area
     66 between IPX and the application for a single IPX operation.  You should set
     67 up a separate ECB for each IPX operation you perform.
     68 ---------------------------------------------------------------------------*/
     69 typedef struct ECB {
     70 	void *Link_Address;
     71 	void (*Event_Service_Routine)(void);	// APP: event handler (NULL=none)
     72 	unsigned char InUse;							// IPX: 0 = event complete
     73 	unsigned char CompletionCode;				// IPX: event's return code
     74 	unsigned short SocketNumber;				// APP: socket to send data through
     75 	unsigned short ConnectionID;				// returned by Listen (???)
     76 	unsigned short RestOfWorkspace;
     77 	unsigned char DriverWorkspace[12];
     78 	unsigned char ImmediateAddress[6];		// returned by Get_Local_Target
     79 	unsigned short PacketCount;
     80 	struct {
     81 		void *Address;
     82 		unsigned short Length;
     83 	} Packet[2];
     84 } ECBType;
     85 
     86 
     87 /*---------------------------------------------------------------------------
     88 This structure is used for calling DPMI function 0x300, Call-Real-Mode-
     89 Interrupt.  It passes register values to & from the interrupt handler.
     90 ---------------------------------------------------------------------------*/
     91 typedef struct {
     92 	long edi;
     93 	long esi;
     94 	long ebp;
     95 	long Reserved;
     96 	long ebx;
     97 	long edx;
     98 	long ecx;
     99 	long eax;
    100 	short Flags;
    101 	short es;
    102 	short ds;
    103 	short fs;
    104 	short gs;
    105 	short ip;
    106 	short cs;
    107 	short sp;
    108 	short ss;
    109 } RMIType;
    110 
    111 /*
    112 ********************************** Defines **********************************
    113 */
    114 /*---------------------------------------------------------------------------
    115 These defines are for the IPX functions.  The function number is specified 
    116 by placing it in BX when IPX is called.  There are two ways to invoke IPX: 
    117 use interrupt 0x7a, or use a function whose address is obtained by calling 
    118 interrupt 0x2f with AX=0x7a00; the function address is returned in ES:DI.  
    119 This is the preferred method, since other apps are known to use int 0x7a.
    120 ---------------------------------------------------------------------------*/
    121 #define	IPX_OPEN_SOCKET						0x0000
    122 #define	IPX_CLOSE_SOCKET						0x0001
    123 #define	IPX_GET_LOCAL_TARGET					0x0002
    124 #define	IPX_SEND_PACKET						0x0003
    125 #define	IPX_LISTEN_FOR_PACKET				0x0004
    126 #define	IPX_SCHEDULE_EVENT					0x0005
    127 #define	IPX_CANCEL_EVENT						0x0006
    128 #define	IPX_GET_INTERVAL_MARKER				0x0008
    129 #define	IPX_GET_INTERNETWORK_ADDRESS		0x0009
    130 #define	IPX_RELINQUISH_CONTROL				0x000A
    131 #define	IPX_DISCONNECT_FROM_TARGET			0x000B
    132 
    133 /*---------------------------------------------------------------------------
    134 These defines are for various IPX error codes:
    135 ---------------------------------------------------------------------------*/
    136 #define	IPXERR_CONNECTION_SEVERED			0x00ec
    137 #define	IPXERR_CONNECTION_FAILED			0x00ed
    138 #define	IPXERR_NO_CONNECTION					0x00ee
    139 #define	IPXERR_CONNECTION_TABLE_FULL		0x00ef
    140 #define	IPXERR_NO_CANCEL_ECB					0x00f9
    141 #define	IPXERR_NO_PATH							0x00fa
    142 #define	IPXERR_ECB_INACTIVE					0x00fc
    143 #define	IPXERR_INVALID_PACKET_LENGTH		0x00fd
    144 #define	IPXERR_SOCKET_TABLE_FULL			0x00fe
    145 #define	IPXERR_SOCKET_ERROR					0x00ff
    146 
    147 /*---------------------------------------------------------------------------
    148 These defines are for various interrupt vectors and DPMI functions:
    149 ---------------------------------------------------------------------------*/
    150 #define	IPX_INT									0x007a
    151 #define	DPMI_INT									0x0031
    152 #define	DPMI_ALLOC_DOS_MEM					0x0100
    153 #define	DPMI_FREE_DOS_MEM						0x0101
    154 #define	DPMI_CALL_REAL_INT					0x0300
    155 #define	DPMI_LOCK_MEM							0x0600
    156 #define	DPMI_UNLOCK_MEM						0x0601
    157 
    158 /*
    159 ******************************** Prototypes *********************************
    160 */
    161 /*---------------------------------------------------------------------------
    162 NOTE: All routines return 0 for a success code and one of the above IPX
    163 error codes if there's an error, EXCEPT:
    164 - IPX_SPX_Installed (0 = not installed)
    165 - Get_Connection_Number / Get_1st_Connection_Number (0 = no connection)
    166 ---------------------------------------------------------------------------*/
    167 /*
    168 .................................. ipx.cpp ..................................
    169 */
    170 int IPX_SPX_Installed(void);
    171 int IPX_Open_Socket(unsigned short socket);
    172 int IPX_Close_Socket(unsigned short socket);
    173 int IPX_Get_Connection_Number(void);
    174 int IPX_Get_1st_Connection_Num (char *username);
    175 int IPX_Get_Internet_Address(int connection_number, 
    176 	unsigned char *network_number, unsigned char *physical_node);
    177 int IPX_Get_User_ID(int connection_number, char *user_id);
    178 int IPX_Listen_For_Packet(struct ECB *ecb_ptr);
    179 void IPX_Send_Packet(struct ECB *ecb_ptr);
    180 int IPX_Get_Local_Target(unsigned char *dest_network, unsigned char *dest_node,
    181 	unsigned short dest_socket, unsigned char *bridge_address);
    182 int IPX_Cancel_Event(struct ECB *ecb_ptr);
    183 void Let_IPX_Breath(void);
    184 
    185 #endif
    186 
    187 /***************************** end of ipx.h ********************************/
    188