//===========================================================================//
// File:	l4host.hpp                                                          //
// Project: MUNGA           Brick: Connection Library                        //
// Contents: additional L4 data types and functions for hosts                //
//---------------------------------------------------------------------------//
//   Date    Who  Modification                                               //
// --------  ---  ---------------------------------------------------------- //
// 04/09/95  GAC  Initial coding.                                            //
//---------------------------------------------------------------------------//
// Copyright (C) 1994-1995, Virtual World Entertainment, Inc.                //
// All Rights reserved worldwide                                             //
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL               //
//===========================================================================//

#pragma once

#include "..\munga\host.h"
#include "..\munga\cstr.h"

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ L4Host ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

#define	L4HOST_PAD_BUFFER_SIZE	4096

	//
	//--------------------------------------------------------------------
	// L4Host
	//
	// Derived from Host, so we can add a place to store the host's network
	// socket pointer.
	//--------------------------------------------------------------------
	//

	class L4Host:
		public Host
	{
	public:
		//
		//--------------------------------------------------------------------
		// Construction, Destruction, and testing
		//--------------------------------------------------------------------
		//
		L4Host(
			HostID			host_ID,
			HostType			host_type,
			const SOCKADDR_IN *network_address,
			//WinSock support :ADB 01/06/07
			//unsigned long	NetworkSocket,
			SOCKET NetworkScocket,
			const CString	&net_name);
		~L4Host();
		//
		//--------------------------------------------------------------------
		// Accessors
		//--------------------------------------------------------------------
		//
#if 0
		enum ConnectionStatus
		{
			NoNetworkConnectionStatus,			// Initial state, host just created with no net link
			OpeningConnectionStatus,			// Waiting for completion of an active open to this host
			ListeningConnectionStatus,			// Waiting for this host to connect to us
			OnLineConnectionStatus           // Host is on-line and ready
		};
		ConnectionStatus
			GetConnectStatus()
				{return ConnectStatus;}
		void
			SetConnectStatus(ConnectionStatus new_status)
				{ConnectStatus = new_status;}
#endif
		//WinSock support :ADB 01/06/07
		//unsigned long GetNetworkSocket()
		SOCKET GetNetworkSocket()
				{return NetworkSocket;}
		void
			SetNetworkSocket(unsigned long net_socket)
				{NetworkSocket = net_socket;}
		CString
			GetSymbolicName()
				{return SymbolicName;}
		//
		// Nasty to make these things public but I'll have to clean them later
		//
	public:
		#if defined(TRACE_SEND_BUFFER)
		TraceOf<int>
			*sendBufferTrace;
		char
			sendBufferTraceName[50];
		#endif
		char
			pad_buffer[L4HOST_PAD_BUFFER_SIZE];		// a place to buffer up messages
		unsigned short
			pad_size,         // total size of the pad buffer
			pad_head,			// circular buffer pointers for keeping track of the
			pad_tail;         // data in the pad buffer.
		//
		//--------------------------------------------------------------------
		// Private data
		//--------------------------------------------------------------------
		//
	private:
		//WinSock support :ADB 01/06/07
		//unsigned long NetworkSocket;		//	address of the network socket this host uses
		SOCKET NetworkSocket;		//	address of the network socket this host uses
#if 0
		ConnectionStatus
			ConnectStatus;		// current connection status
#endif
	CString
		SymbolicName;  	// Text version of net address from egg
};