//////////////////////////////////////////////////////////////////////////////
//
// Asura_Platform_NetSocket.h
//
// Copyright (c) 2006 Rebellion. All rights reserved.
//
//////////////////////////////////////////////////////////////////////////////

#if defined ASURA_USE_PRAGMA_ONCE
    #pragma once
#endif

#if !defined __ASURA_PLATFORM_NETSOCKET_H__
#define __ASURA_PLATFORM_NETSOCKET_H__

/******************************************************************************/
/* Macros                                                                     */
/******************************************************************************/

// On the Xbox, use the VDP protocol which allows for combined game and voice data
// (game data is sent encrypted, voice unencrypted)
// On other platforms, we will want to use IPPROTO_UDP
#define ASURA_NETSOCKET_PROTOCOL IPPROTO_VDP

// On XBox the IP+VDP header size ranges from 44 to 51, so say 48 on average.
// On PC/PS2 IP+UDP header size is 28 bytes
#define ASURA_NETSOCKET_PROTOCOL_PACKETHEADERSIZE 48


// 3658 is the IANA-registered PS2 port. 1000 should be used by Xbox as it gives the smallest packet header.
// On PC it doesn't matter, but we might as well use the PS2 one so we can easily do PC vs PS2 games.
#define ASURA_NETSOCKET_DEFAULTPORT 1000


// RJF - 28 January 2005 - The one major problem with VDP is that it doesn't support SO_BROADCAST which screws
// us over when it comes to LAN games. We need to use a UDP socket for broadcasts instead. (May Microsoft be 
// eternally blessed for this decision...) There's a flag on Asura_NetSocket - m_bUseAlternativeProtocol - which
// will cause sockets to use this protocol/port pair if they are defined. If they aren't defined, or if
// m_bUseAlternativeProtocol isn't set, the standard protocol and port will be used.
// (MH - 30.01.2009) if ASURA_XBOX360_BYPASS_NETWORK_SECURITY is defined, the alternative protocol is always used.

// In other words: if you don't define these symbols, everything should work the way it used to...

#define ASURA_NETSOCKET_ALTERNATIVE_PROTOCOL	IPPROTO_UDP
#define ASURA_NETSOCKET_ALTERNATIVE_PORT		(1001)

/******************************************************************************/
/* Types                                                                      */
/******************************************************************************/

typedef u_int Asura_NetAddress;

#endif // !defined __ASURA_PLATFORM_NETSOCKET_H__
