CnC_Remastered_Collection

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

IPXGCONN.H (7735B)


      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:   F:\projects\c&c\vcs\code\ipxgconn.h_v   1.10   16 Oct 1995 16:47:30   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 : IPXGCONN.H                               *
     24  *                                                                         *
     25  *                   Programmer : Bill Randolph                            *
     26  *                                                                         *
     27  *                   Start Date : December 19, 1994                        *
     28  *                                                                         *
     29  *                  Last Update : April 11, 1995   [BR]                 	*
     30  *                                                                         *
     31  *-------------------------------------------------------------------------*
     32  *                                                                         *
     33  * This class is a special type of IPX Connection.  It can talk to more		*
     34  * than one system at a time.  It can Broadcast packets to all systems,		*
     35  * or send a packet to one individual system.  The packets it sends to		*
     36  * individual systems can be DATA_NOACK or DATA_ACK packets, but the			*
     37  * packets broadcast have to be DATA_NOACK packets.  This class is for		*
     38  * only the crudest "Who-are-you" type of network communications.  Once		*
     39  * the IPX Address of another system is identified, a "real" IPX				*
     40  * Connection should be created, & further communications done through it.	*
     41  *																									*
     42  * This means that the packet ID field no longer can be used to detect		*
     43  * resends, since the receive queue may recieve a lot more packets than		*
     44  * we send out.  So, re-sends cannot be detected; the application must be	*
     45  * designed so that it can handle multiple copies of the same packet.		*
     46  *																									*
     47  * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
     48 
     49 #ifndef IPXGLOBALCONN_H
     50 #define IPXGLOBALCONN_H
     51 
     52 
     53 #include "ipxconn.h"
     54 
     55 
     56 /*
     57 ********************************** Defines **********************************
     58 */
     59 /*---------------------------------------------------------------------------
     60 This is the header for Global Connection messages.  It includes the usual
     61 "standard" header that the other connections do; but it also includes an
     62 IPX address field, so the application can get the address of the sender
     63 of this message.  This address field must be provided in by the IXP 
     64 Connection Manager class, when it calls this class's Receive_Packet function.
     65 ---------------------------------------------------------------------------*/
     66 typedef struct {
     67 	CommHeaderType Header;
     68 	IPXAddressClass Address;
     69 	unsigned short ProductID;
     70 } GlobalHeaderType;
     71 
     72 
     73 /*
     74 ***************************** Class Declaration *****************************
     75 */
     76 class IPXGlobalConnClass : public IPXConnClass
     77 {
     78 	/*
     79 	---------------------------- Public Interface ----------------------------
     80 	*/
     81 	public:
     82 		/*.....................................................................
     83 		Here are some useful enums:
     84 		.....................................................................*/
     85 		enum GlobalConnectionEnum {
     86 			/*..................................................................
     87 			This is the magic number for all Global Connections.  Having the
     88 			same magic number across products lets us ID different products
     89 			on the net.
     90 			..................................................................*/
     91 			GLOBAL_MAGICNUM = 0x1234,
     92 			/*..................................................................
     93 			These are the values used for the ProductID field in the Global
     94 			Message structure.  It also should be the Magic Number used for the 
     95 			private connections within that product.
     96 			This list should be continually updated & kept current.  Never ever 
     97 			ever use an old product ID for your product!
     98 			..................................................................*/
     99 			COMMAND_AND_CONQUER = 0xaa01,
    100 		};
    101 
    102 		/*.....................................................................
    103 		Constructor/destructor.
    104 		.....................................................................*/
    105 		IPXGlobalConnClass (int numsend, int numrecieve, int maxlen, 
    106 			unsigned short product_id);
    107 		virtual ~IPXGlobalConnClass () {};
    108 
    109 		/*.....................................................................
    110 		Send/Receive routines.
    111 		.....................................................................*/
    112 		virtual int Send_Packet (void * buf, int buflen, 
    113 			IPXAddressClass *address, int ack_req);
    114 		virtual int Receive_Packet (void * buf, int buflen,
    115 			IPXAddressClass *address);
    116 		virtual int Get_Packet (void * buf, int *buflen,
    117 			IPXAddressClass *address, unsigned short *product_id);
    118 
    119 		/*.....................................................................
    120 		This is for telling the connection it can cross a bridge.
    121 		.....................................................................*/
    122 		void Set_Bridge (NetNumType bridge);
    123 
    124 		/*.....................................................................
    125 		The Product ID for this product.
    126 		.....................................................................*/
    127 		unsigned short ProductID;
    128 
    129 		/*.....................................................................
    130 		This describes the address of a bridge we have to cross.  This class
    131 		supports crossing only one bridge.  Storing the bridge's network number
    132 		allows us to obtain its local target address only once, then re-use it.
    133 		.....................................................................*/
    134 		NetNumType BridgeNet;
    135 		NetNodeType BridgeNode;
    136 		int IsBridge;
    137 
    138 	/*
    139 	-------------------------- Protected Interface ---------------------------
    140 	*/
    141 	protected:
    142 
    143 		/*.....................................................................
    144 		This is the overloaded Send routine declared in ConnectionClass, and
    145 		used in SequencedConnClass.  This special version sends to the address
    146 		embedded within the GlobalHeaderType.
    147 		.....................................................................*/
    148 		virtual int Send (char *buf, int buflen);
    149 
    150 		/*.....................................................................
    151 		This routine is overloaded from SequencedConnClass, because the
    152 		Global Connection needs to ACK its packets differently from the
    153 		other connections.
    154 		.....................................................................*/
    155 		virtual int Service_Receive_Queue (void);
    156 };
    157 
    158 #endif