FIELD.H (3473B)
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 /*************************************************************************** 17 * * 18 * Project Name : Westwood Auto Registration App * 19 * * 20 * File Name : FIELD.H * 21 * * 22 * Programmer : Philip W. Gorrow * 23 * * 24 * Start Date : 04/22/96 * 25 * * 26 * Last Update : April 22, 1996 [PWG] * 27 * * 28 * This module takes care of maintaining the field list used to process * 29 * packets. * 30 * * 31 *-------------------------------------------------------------------------* 32 * Functions: * 33 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ 34 #ifndef __FIELD_H 35 #define __FIELD_H 36 37 #include <windows.h> 38 #include <winsock.h> 39 40 #define FIELD_HEADER_SIZE (sizeof(FieldClass) - (sizeof(void *) * 2)) 41 42 #define TYPE_CHAR 1 43 #define TYPE_UNSIGNED_CHAR 2 44 #define TYPE_SHORT 3 45 #define TYPE_UNSIGNED_SHORT 4 46 #define TYPE_LONG 5 47 #define TYPE_UNSIGNED_LONG 6 48 #define TYPE_STRING 7 49 #define TYPE_CHUNK 20 50 51 class PacketClass; 52 53 class FieldClass { 54 55 public: 56 friend class PacketClass; 57 // 58 // Define constructors to be able to create all the different kinds 59 // of fields. 60 // 61 FieldClass(void) {}; 62 FieldClass(char *id, char data); 63 FieldClass(char *id, unsigned char data); 64 FieldClass(char *id, short data); 65 FieldClass(char *id, unsigned short data); 66 FieldClass(char *id, long data); 67 FieldClass(char *id, unsigned long data); 68 FieldClass(char *id, char *data); 69 FieldClass(char *id, void *data, int length); 70 71 void Host_To_Net(void); 72 void Net_To_Host(void); 73 74 private: 75 char ID[4]; // id value of this field 76 unsigned short DataType; // id of the data type we are using 77 unsigned short Size; // size of the data portion of this field 78 void *Data; // pointer to the data portion of this field 79 FieldClass *Next; // pointer to the next field in the field list 80 }; 81 82 #endif