#ifndef TDPSessionDescH #define TDPSessionDescH // ========================================================================== // File: TDPSessionDesc.H // Authors: BCB_Code_Generator v1.62, // Darren Dwyer (source code, documentation, demos, website), // Hugh Edwards (documentation, icons), // Brian Austin (some source code, documentation) // Description: This file defines the TDPSessionDesc Component // // "TDx_Play_Library v1.62" // (c) 2002 BCB-Tools.com Pty. Ltd., Sydney, Australia. // All Rights Reserved. // // Refer to the 'Licence.Txt' file for licencing & copyright information. // ========================================================================== // -------------------------------------------------------------------------- #include "TDx_Library_Defns.H" #include "TDx_Library_Functions.H" // -------------------------------------------------------------------------- #include "TDx_Play_Library_Defns.H" #include "TDx_Play_Library_Functions.H" // ========================================================================== // Set: TDPSessionDescFlags_Set // Description: A set of mangled DirectX flag names that are used to set the // TDPSessionDesc::Flags property using the BCB Object // Inspector. For detailed descriptions of each flag, see the // Flags property description below. // ========================================================================== enum TDPSessionDesc_Flags_Flags { dpsession_clientserver, dpsession_directplayprotocol, dpsession_joindisabled, dpsession_keepalive, dpsession_migratehost, dpsession_multicastserver, dpsession_newplayersdisabled, dpsession_nodatamessages, dpsession_nomessageid, dpsession_nopreserveorder, dpsession_optimizelatency, dpsession_passwordrequired, dpsession_private, dpsession_secureserver }; typedef Set< TDPSessionDesc_Flags_Flags, dpsession_clientserver, dpsession_secureserver > TDPSessionDesc_Flags_Set; // -------------------------------------------------------------------------- // ========================================================================== // Class: TDPSessionDesc // Description: The TDPSessionDesc component wraps the DirectX DPSESSIONDESC2 // structure which holds information describing the session // capabilities. // // Use this component with TDx_Play::Open(), // TDx_Play::SecureOpen() and TDx_Play::SetSessionDesc() // methods to define the properties of a session. // // The TDx_Play::EnumSessions() method uses it to curtail the // sessions enumerated and the // TDx_Play::OnEnumSessionsCallback() event uses it to describe // the session currently being enumerated. // // Finally, TDPLConnection::SessionDesc references this // component to describe the session being created or joined. // ========================================================================== #if (__BORLANDC__ >= 0x0530) // BCB Version 3 + class PACKAGE TDPSessionDesc : public TComponent { // -------------------------------------------------------------------------- #else // BCB Version 1 class TDPSessionDesc : public TComponent { #endif // ========================================================================== __published: // ========================================================================== // ---------------------------------------------------------------------- // Property: Flags_ // Description: The Flags property defines flags indicating the nature of // the session. // The described effect applies when the flag is set. // // Some of these flags, as noted, may not be modified once // the session has been created. // Note: This property is used to set the various DirectX Flags // for the 'Flags' property via the BCB Object Inspector. // For detailed descriptions of each flag, see the Flags // property description below. // ---------------------------------------------------------------------- __property TDPSessionDesc_Flags_Set Flags_ = { read=FGetFlags_, write=FSetFlags_, nodefault }; // ---------------------------------------------------------------------- // Property: CurrentPlayers // Description: The CurrentPlayers property defines the current number of // players in the session. // ---------------------------------------------------------------------- __property dword CurrentPlayers = { read=FGetCurrentPlayers, write=FSetCurrentPlayers, default=0 }; // ---------------------------------------------------------------------- // Property: MaxPlayers // Description: The MaxPlayers property defines the maximum number of // players allowed in the session. // // Set to 0 for no maximum player numbers. // ---------------------------------------------------------------------- __property dword MaxPlayers = { read=FGetMaxPlayers, write=FSetMaxPlayers, default=0 }; // ---------------------------------------------------------------------- // Property: PasswordA // Description: The PasswordA property references the password used to // join the session, stored as an ANSI string. // ---------------------------------------------------------------------- __property AnsiString PasswordA = { read=FGetPasswordA, write=FSetPasswordA, nodefault }; // ---------------------------------------------------------------------- // Property: SessionNameA // Description: The SessionNameA property references the name of the // session, stored as an ANSI string. // ---------------------------------------------------------------------- __property AnsiString SessionNameA = { read=FGetSessionNameA, write=FSetSessionNameA, nodefault }; // ---------------------------------------------------------------------- // Property: Size // Description: The Size property contains the size in bytes of the // internal DPSESSIONDESC2 structure. // ---------------------------------------------------------------------- __property dword Size = { read=FGetSize, write=FSetSize, default=sizeof(DPSESSIONDESC2) }; // ---------------------------------------------------------------------- // Property: User1 // Description: The User1 property defines data specified and used by the // application for the session. // ---------------------------------------------------------------------- __property dword User1 = { read=FGetUser1, write=FSetUser1, default=0 }; // ---------------------------------------------------------------------- // Property: User2 // Description: The User2 property defines data specified and used by the // application for the session. // ---------------------------------------------------------------------- __property dword User2 = { read=FGetUser2, write=FSetUser2, default=0 }; // ---------------------------------------------------------------------- // Property: User3 // Description: The User3 property defines data specified and used by the // application for the session. // ---------------------------------------------------------------------- __property dword User3 = { read=FGetUser3, write=FSetUser3, default=0 }; // ---------------------------------------------------------------------- // Property: User4 // Description: The User4 property defines data specified and used by the // application for the session. // ---------------------------------------------------------------------- __property dword User4 = { read=FGetUser4, write=FSetUser4, default=0 }; // ---------------------------------------------------------------------- // Event: OnError() // Description: The OnError event is called when an error occurs in the // TDPSessionDesc component. // ---------------------------------------------------------------------- __property TDx_Error OnError = {read=FOnError, write=FOnError, nodefault}; // ========================================================================== public: // ========================================================================== // ---------------------------------------------------------------------- // Property: Application // Description: The Application property identifies the application that // is running in this session. // // This is used to ensure that connections are only made to // computers running the same application. // Set to GUID_NULL to enumerate all application sessions. // ---------------------------------------------------------------------- __property GUID Application = { read=FGetApplication, write=FSetApplication, nodefault }; // ---------------------------------------------------------------------- // Property: ErrorValue // Description: The ErrorValue property contains the last error value // returned from a call to a TDPSessionDesc method or // fget/fset. eg. DP_OK or DDERR_SURFACELOST or TDX_ERROR // ---------------------------------------------------------------------- __property HRESULT ErrorValue = { read=FGetErrorValue, write=FSetErrorValue, default=DP_OK }; // ---------------------------------------------------------------------- // Property: Flags // Description: The Flags property defines flags indicating the nature of // the session. // The described effect applies when the flag is set. // // Some of these flags, as noted, may not be modified once // the session has been created. // Flags: DPSESSION_CLIENTSERVER - // This is a client/server session hosted by an // application server process. // // Cannot be modified once the session is created. // Clients joining the session can only enumerate local // players and the server player. // The session host will see all the sessions players and // can only create a server player. // Incompatible with DPSESSION_MIGRATEHOST. // DPSESSION_DIRECTPLAYPROTOCOL - // The session is to use the DirectPlay guaranteed // protocol, not the guaranteed protocol implemented by // the service provider. // // Setting this flag allows message throttling, all // TDx_Play::SendEx() functionallity and guaranteed // messaging ability, as well as using DirectPlay TCP/IP // reliablilty code to improve throughput and delivery. // DPSESSION_JOINDISABLED - // No new applications can join the session. // // Calls to TDx_Play::Open() with the DPOPEN_JOIN flag and // this sessions GUID will fail. // The number of remote players will otherwise be limited // by TDPSessiondDesc::MaxPlayers. // DPSESSION_KEEPALIVE - // Abnormally disconnected remote players will be detected // and deleted from the session. // // Cannot be modified once the session is created. // When disconnection was due to a temporary // communications problem, the rejoining player will be // informed that they have been dropped from the session // by a DPMSG_SESSIONLOST message. // A disconnected player will cause the session to be // terminated if this flag is not set. // DPSESSION_MIGRATEHOST - // Enables another computer to become the host if the // current host leaves the session. // // Cannot be modified once the session is created. // A DPMSG_HOST system message will be sent to players on // the new host. // Incompatible with DPSESSION_CLIENTSERVER, // DPSESSION_MULTICASTSERVER and DPSESSION_SECURESERVER. // The session becomes unavailable to new players and // computers when the host exits if this flag is not set. // DPSESSION_MULTICASTSERVER - // All group and broadcast messages will be routed through // the host, which will multicast the message to all // recipients. // // Cannot be modified once the session is created. // Incompatible with DPSESSION_MIGRATEHOST. // DPSESSION_NEWPLAYERSDISABLED - // No new players or applications can can be created or // join the session. // // TDx_Play::CreatePlayer() will return an error. // The number of remote players will otherwise be limited // by TDPSessiondDesc::MaxPlayers. // DPSESSION_NODATAMESSAGES - // System messages regarding updates to remote // player/group/session data will not be generated. // // The methods that generate data messages are // TDx_Play::SetPlayerData(), TDx_Play::SetGroupData(), // TDx_Play::SetPlayerName(), TDx_Play::SetGroupName() and // TDx_Play::SetSessionDesc(). // DPMSG_SETSESSIONDESC will also be suppressed. // DPSESSION_NOMESSAGEID - // Information indicating the sender and receiver of a // message will not be attached to the message. // // Cannot be modified once the session is created. // This can reduce message overhead when the id's are not // relevent. // DPSESSION_NOPRESERVEORDER - // The order in which guaranteed messages are received is // irrelevent. // // If the order of messages receipt is not important, // delays may be reduced by using this flag. // DPSESSION_OPTIMIZELATENCY - // Optimises communications for latency, as opposed to // bandwidth. // // This flag disables TCP/IP nagling. // DPSESSION_PASSWORDREQUIRED - // The session requires a password to join. // // This read only flag is automatically set when // TDPSessionDesc::Password or TDPSessionDesc::PasswordA // is not NULL. // DPSESSION_PRIVATE - // The session is private and will not be enumerated // unless a matching password is provided. // DPSESSION_SECURESERVER - // The host of the session is a secure server and // credentials must be supplied before it can be opened. // // Cannot be modified once the session is created. // Incompatible with DPSESSION_MIGRATEHOST. // ---------------------------------------------------------------------- __property dword Flags = { read=FGetFlags, write=FSetFlags, default=0 }; // ---------------------------------------------------------------------- // Property: Instance // Description: The Instance property identifies the session instance. // ---------------------------------------------------------------------- __property GUID Instance = { read=FGetInstance, write=FSetInstance, nodefault }; // ---------------------------------------------------------------------- // Property: Password // Description: The Password property references the password used to // join the session, stored as a unicode string. // ---------------------------------------------------------------------- __property AnsiString Password = { read=FGetPassword, write=FSetPassword, nodefault }; // ---------------------------------------------------------------------- // Property: SessionName // Description: The SessionName property references the name of the // session, stored as a unicode string. // ---------------------------------------------------------------------- __property AnsiString SessionName = { read=FGetSessionName, write=FSetSessionName, nodefault }; // ---------------------------------------------------------------------- // Method: Clear() // Description: The Clear() method can be used to clear the contents of // the TDPSessionDesc's internal DPSESSIONDESC2 structure. // Note: if you have manually linked a structure member to a // chunk of memory, make sure you release this memory before // calling Clear(). // ---------------------------------------------------------------------- virtual void __fastcall Clear(); // ---------------------------------------------------------------------- // Property: Flags_Strings() // Description: This property returns a TStringList containing current // flag values for the Flags property. Note: Any memory // associated with these strings is released on destruction. // ---------------------------------------------------------------------- __property TStringList* Flags_Strings = { read=FGetFlags_Strings }; // ---------------------------------------------------------------------- // Constructor() and Destructor() // ---------------------------------------------------------------------- __fastcall TDPSessionDesc(TComponent* Owner); virtual __fastcall ~TDPSessionDesc(); // ---------------------------------------------------------------------- // Internal Structure Access // ---------------------------------------------------------------------- __property DPSESSIONDESC2* Internal_DPSESSIONDESC2_Ptr = { read=FGetInternal_DPSESSIONDESC2_Ptr, nodefault }; void __fastcall Internal_DPSESSIONDESC2_Update(); // ========================================================================== protected: // ========================================================================== // ---------------------------------------------------------------------- // Object Inspector 'Flag' Access Methods // ---------------------------------------------------------------------- TDPSessionDesc_Flags_Set __fastcall FGetFlags_(); void __fastcall FSetFlags_( TDPSessionDesc_Flags_Set pFlags_ ); // ---------------------------------------------------------------------- // Property Access Methods // ---------------------------------------------------------------------- GUID __fastcall FGetApplication(); void __fastcall FSetApplication( GUID pApplication ); dword __fastcall FGetCurrentPlayers(); void __fastcall FSetCurrentPlayers( dword pCurrentPlayers ); HRESULT __fastcall FGetErrorValue(); void __fastcall FSetErrorValue( HRESULT pErrorValue ); dword __fastcall FGetFlags(); void __fastcall FSetFlags( dword pFlags ); GUID __fastcall FGetInstance(); void __fastcall FSetInstance( GUID pInstance ); dword __fastcall FGetMaxPlayers(); void __fastcall FSetMaxPlayers( dword pMaxPlayers ); AnsiString __fastcall FGetPassword(); void __fastcall FSetPassword( AnsiString pPassword ); AnsiString __fastcall FGetPasswordA(); void __fastcall FSetPasswordA( AnsiString pPasswordA ); AnsiString __fastcall FGetSessionName(); void __fastcall FSetSessionName( AnsiString pSessionName ); AnsiString __fastcall FGetSessionNameA(); void __fastcall FSetSessionNameA( AnsiString pSessionNameA ); dword __fastcall FGetSize(); void __fastcall FSetSize( dword pSize ); dword __fastcall FGetUser1(); void __fastcall FSetUser1( dword pUser1 ); dword __fastcall FGetUser2(); void __fastcall FSetUser2( dword pUser2 ); dword __fastcall FGetUser3(); void __fastcall FSetUser3( dword pUser3 ); dword __fastcall FGetUser4(); void __fastcall FSetUser4( dword pUser4 ); // ---------------------------------------------------------------------- // Flag_Strings Access Methods // ---------------------------------------------------------------------- TStringList* __fastcall FGetFlags_Strings(); // ========================================================================== private: // ========================================================================== // ---------------------------------------------------------------------- // Internal Structure Access // ---------------------------------------------------------------------- DPSESSIONDESC2* __fastcall FGetInternal_DPSESSIONDESC2_Ptr(); void __fastcall FSetInternal_DPSESSIONDESC2( DPSESSIONDESC2* pDPSESSIONDESC2 ); // ---------------------------------------------------------------------- // Property Variables // ---------------------------------------------------------------------- GUID fApplication; HRESULT fErrorValue; GUID fInstance; AnsiString fPassword; AnsiString fPasswordA; AnsiString fSessionName; AnsiString fSessionNameA; // ---------------------------------------------------------------------- // Flags_Strings Variables // ---------------------------------------------------------------------- TStringList* fFlags_Strings; // ---------------------------------------------------------------------- // Structure Variables // ---------------------------------------------------------------------- DPSESSIONDESC2 fDPSESSIONDESC2; // ---------------------------------------------------------------------- // Event Variables // ---------------------------------------------------------------------- TDx_Error FOnError; }; // -------------------------------------------------------------------------- #endif // --------------------------------------------------------------------------