///////////////////////////////////////////////////////////////////////////////
/// @file deNetWinsock.hpp
///
/// @brief 
///
/// @author trajar
///
/// This file is the intellectual property of Novus Delta, LLC.. Usage of the
/// contents of this file is subject to the Destiny3D Member License which
/// can be found at http://www.destiny3d.com.  Any other usage is prohibited.
///
/// This file is distributed "AS IS" without warranty of any kind.  Novus
/// Delta, LLC. does not guarantee the fitness of the contents of this file
/// for any particular purpose.
///
/// Copyright (C) 2001-2003 Novus Delta, LLC. All Rights Reserved.
///
/// <hr>
///                                 Change History
/// <hr>
///
/// @date Jun 2002
/// @author trajar
/// @remarks Creation
///
///////////////////////////////////////////////////////////////////////////////

#ifndef	_DENETWINSOCK_HPP
#define _DENETWINSOCK_HPP

#ifndef		_DENET_HPP
 #include	"deNet.hpp"
#endif

#include	<WINSOCK2.H>

//-------------------------------------------------------------
// int GetWinsockErrorStr( int iError, char * outBuffer )
//-------------------------------------------------------------
DENET_API int GetWinsockErrorStr( int iError, char * outBuffer );

//-------------------------------------------------------------
// int GetHostAddressStr( char * outBuff )
//-------------------------------------------------------------
DENET_API int GetHostName( char * outBuff );

//-------------------------------------------------------------
// DWORD GetAddressFromStr( char * pHost )
//-------------------------------------------------------------
DENET_API DWORD GetAddressFromName( char * pHost );
	
//-------------------------------------------------------------
// DWORD GetHostAddress()
//-------------------------------------------------------------
DENET_API DWORD GetHostAddress(void);

//-------------------------------------------------------------
// DWORD GetHostPort()
//-------------------------------------------------------------
DENET_API DWORD GetHostPort(void);

//-------------------------------------------------------------
// deNetAddress GetHostNetAddress(void)
//-------------------------------------------------------------
DENET_API deNetAddress GetHostNetAddress(void);

class	deTCPConnection;
class	deTCPConnectionBin;

// struct for overlapped I/O requests
class deTCPOVERLAPPED
{
public:

	deTCPOVERLAPPED(void)
	{
		hSocket			= NULL;
		dwOrgSize		= 0;
		dwFlags			= 0;
		iNumBuffers		= 0;
		bSuccessful		= false;
		bCompleted		= false;
		iNetMsgID		= (WORD)-1;
	}

	~deTCPOVERLAPPED(void)	{ }

	WORD					iNetMsgID;
	WSAOVERLAPPED			wsOverlapped;
	SOCKET					hSocket;
	deTCPConnection	*		pConn;
	deTCPConnectionBin *	pBin;
	DWORD					dwOrgSize;
	DWORD					dwFlags;
	WSABUF					Buffer;
	int						iNumBuffers;
	bool					bSuccessful;
	bool					bCompleted;
};


#endif