//////////////////////////////////////////////////////////////////////////////
//
// Asura_PS2_DNAS.h
//
// Copyright (c) 2003 Rebellion. All rights reserved.
//
// Description:
//
//     interface for the DNAS authentication process
//
//////////////////////////////////////////////////////////////////////////////

// B E G I N   F I L E   W R A P P E R ///////////////////////////////////////

#ifdef ASURA_USE_PRAGMA_ONCE
    #pragma once
#endif

#ifndef ___ASURA_PS2_DNAS_H___
#define ___ASURA_PS2_DNAS_H___ 1

#include "Core/Asura_PlatformBasics.h"	// Asura_UnicodeChar

class Asura_PS2_DNAS
{

	public:

		enum PublicStatus
		{
			DnasStatus_None,
			DnasStatus_Authorising,
			DnasStatus_Authorised,
			DnasStatus_Failed
		};

		static void Initialise( void );
		static void Update( void );
		static void Shutdown( void );
		static void Retry( void );

		// errors - if the DNAS status is DnasStatus_Failed, you can get the 
		// text you need to display using these 4 functions. The display should
		// look something like this:-
		// ----------------------------------------
		//			DNAS Error (-102)
		// ----------------------------------------
		// This software title is not in service. 
		//
		// Please check the start and end dates 
		// for this online title at Central Station 
		// using the Network Access Disc or refer 
		// to PlayStation.com.
		// ----------------------------------------

		static const Asura_UnicodeChar* GetErrorType( void );
		static int GetErrorNumber( void );
		static const Asura_UnicodeChar* GetErrorBody( void );
		static const Asura_UnicodeChar* GetErrorFooter( void );

		static PublicStatus GetStatus( void ) { return s_ePublicStatus; }

		// function for chunk system interface
		static void* GetAuthDataPtr( u_int uBytesRequired );

		// Normally, submission builds pass '0' as the debug flag, while other builds
		//	pass '1'. Since RT is using the 'submission' #define in publisher builds,
		//	we need to override this.
		static void ForceUseDebugDNASServer(bool bDebug);

		static void CancelCurrentQuery( void );

private:
		
		static void BeginAuth( void );
        
		static void* Project_GetPassPhrase( void );
		static u_int Project_GetSizeOfPassPhrase( void );

		static const char* Project_GetDNASFile( void );
        static const char* Project_GetDNASDLLName( void );

		static char* s_pcAuthData;
		static PublicStatus s_ePublicStatus;
		
		static bool s_bUseDebugServer;
};

// E N D   F I L E   W R A P P E R ///////////////////////////////////////////

#endif // #ifndef ___ASURA_PS2_DNAS_H___
