/*
	Lan Wars.
	Copyright (c) 2009, Darragh Coy.
	All rights reserved.
	Original work(s), source code & author(s) details available at: http://www.darraghcoy.com

	Redistribution and use in source and binary forms, with or without modification, are permitted 
	provided that the following conditions are met:

		* 	Redistributions of source code must retain the above copyright notice, this list of 
			conditions and the following disclaimer.
		* 	Redistributions in binary form must reproduce the above copyright notice, this list of 
			conditions and the following disclaimer in the documentation.
		* 	Neither the name of the author nor the names of contributors may be used to endorse or 
			promote products derived from this software without specific prior written permission.
		* 	The use of any third party libraries, modules or data files provided with the source 
			form of the program must follow and respect the individual licensing terms of these 
			components. You do not have permission to modify or circumvent the licensing terms for 
			provided third party components unless the third party licenses specifically allow this. 
			If you do not agree to the terms of provided third party components then you do not have 
			permission to use them in your derived work(s).
		* 	The terms of this license do not apply to separate (but related) distributions if supplied 
			by the author(s), only to the contents of this source distribution, derived works, and the 
			binaries produced by either modified or unmodified versions of the source code. The terms 
			of this license do not also apply to any third party libraries or components provided with 
			the source distribution. Such third party elements are licensed under their own separate 
			agreements.

	THIS SOFTWARE IS PROVIDED BY DARRAGH COY ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, 
	BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
	ARE DISCLAIMED. IN NO EVENT SHALL DARRAGH COY BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
	EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 
	OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
	OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
	IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef GAME_GAME_PACKET_CHUNK_H
#define GAME_GAME_PACKET_CHUNK_H

//=====================================================================================================================
//=====================================================================================================================

namespace Game
{	
	namespace GamePacketChunk
	{
		/// This is the number of bits used to represent a chunk id in a packet
		
		static unsigned CHUNK_ID_BITS = 4;
	
		//=============================================================================================================
		/// This enum identifies a chunk in a game packet. The size and type of data in each chunk will depend on
		/// the chunk itself. Chunks follow each other one after the other within a packet.
		//=============================================================================================================
		
		enum ChunkID
		{		
			/// Client wants to join a server. No data is contained within this chunk.
		
			PKCKID_JOIN = 0 ,
			
			/// Server acknowledeges that the client can join. No data is contained within this chunk.
			
			PKCKID_JOIN_ACK = 1 ,

			/// Server refuses the client requesting to join. No data is contained within this chunk.
			
			PKCKID_JOIN_REFUSE = 2 ,

			/// A disconnect message, either from client to server or server to client. No data is contained within this chunk.
			
			PKCKID_DISCONNECT = 3 ,

			//'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
			/// This chunk contains creation data for an object. This is only sent from client to server, clients 
			/// cannot create objects without permission from the server. Data that follows the chunk ID includes:
			/// uint32 - net id of the object
			/// uint?  - a number of bits identifying the TYPE of object being created. The number of bits is 
			///			 decided upon by the GameNetSerializer class.
			/// ???	   - creation data specific to each object.
			//'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
			
			PKCKID_CREATE = 4 ,
			
			//'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
			/// This chunk contains game data for a game object. Data that follows the chunk ID includes:
			/// uint32  - net id of the object
			/// ???		- game state data specific to each object
			//'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
			
			PKCKID_GAME_DATA = 5 ,
			
			//'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
			/// This chunk is a request from a server to a client to delete an object in the game world.
			/// uint32  - net id of the object to delete
			//'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
			
			PKCKID_DELETE = 6 ,

			/// Terminating chunk id. This chunk should always be at the end of a valid packet to mark the end of the packet. 
			
			PKCKID_END = 7 ,
			
			//'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
			/// Message from client to server. Acknowledges receipt of object creation message. Data that follows this 
			/// chunk includes:
			/// uint32	- net id of the object being acknowledged.
			//'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
			
			PKCKID_CREATE_ACK = 8 ,
			
			//'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
			/// Message from client to server. Acknowledges receipt of object deletion mnessage. Data that follows this 
			/// chunk includes:
			/// uint32	- net id of the object being acknowledged.
			//'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
			
			PKCKID_DELETE_ACK = 9 ,
			
			//'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
			/// From server to client. Chunk signifiying that the client is receiving updates for remote objects.
			/// Whichever objects the client does not receive updates for are presumed out of scope.
			/// There is no data for this chunk.
			//'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
			
			PKCKID_REMOTE_UPDATE = 10 ,
			
			/// Invalid chunk id. Anything greater than or equal to this chunk id is an invalid chunk.
			
			PKCKID_INVALID = 11
		};
	};
};

#endif
