home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / pc / DirectX SDK / DXSDK / samples / Multimedia / DirectPlay / Maze / MazeCommon / NetAbstract.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-10-31  |  2.5 KB  |  87 lines

  1. //----------------------------------------------------------------------------
  2. // File: netabstract.h
  3. //
  4. // Desc: see main.cpp
  5. //
  6. // Copyright (c) 1999-2001 Microsoft Corp. All rights reserved.
  7. //-----------------------------------------------------------------------------
  8. #ifndef _NETABSTRACT_H
  9. #define _NETABSTRACT_H
  10.  
  11.  
  12. #define SERVER_ID   1
  13. enum { DISCONNNECT_REASON_UNKNOWN = 0, DISCONNNECT_REASON_CLIENT_OUT_OF_DATE };
  14.  
  15.  
  16.  
  17. //-----------------------------------------------------------------------------
  18. // Name: 
  19. // Desc: 
  20. //-----------------------------------------------------------------------------
  21. interface   INetServer
  22. {
  23. public:
  24.     virtual ~INetServer() {} ;
  25.  
  26.     virtual HRESULT OnPacket( DWORD dwFrom, void* dwData, DWORD dwSize ) = 0;
  27.     virtual void    OnAddConnection( DWORD dwID ) = 0;
  28.     virtual void    OnRemoveConnection( DWORD dwID ) = 0;
  29.     virtual void    OnSessionLost( DWORD dwReason ) = 0;
  30. };
  31.  
  32.  
  33.  
  34.  
  35.  
  36. //-----------------------------------------------------------------------------
  37. // Name: 
  38. // Desc: 
  39. //-----------------------------------------------------------------------------
  40. interface   INetClient
  41. {
  42. public:
  43.     virtual ~INetClient() {} ;
  44.  
  45.     virtual HRESULT OnPacket( DWORD dwFrom, void* dwData, DWORD dwSize ) = 0;
  46.     virtual void    OnSessionLost( DWORD dwReason ) = 0;
  47. };
  48.  
  49.  
  50.  
  51.  
  52. //-----------------------------------------------------------------------------
  53. // Name: 
  54. // Desc: 
  55. //-----------------------------------------------------------------------------
  56. interface   IOutboundServer
  57. {
  58. public:
  59.     virtual HRESULT SendPacket( DWORD dwTo, void* dwData, DWORD dwSize, 
  60.                                 BOOL dwGuaranteed, DWORD dwTimeout ) = 0;
  61.     virtual HRESULT GetConnectionInfo( DWORD dwID, TCHAR* strConnectionInfo ) = 0;
  62.     virtual HRESULT RejectClient( DWORD dwID, HRESULT hrReason ) = 0;
  63. };
  64.  
  65.  
  66.  
  67.  
  68. //-----------------------------------------------------------------------------
  69. // Name: 
  70. // Desc: 
  71. //-----------------------------------------------------------------------------
  72. interface   IOutboundClient
  73. {
  74. public:
  75.     virtual HRESULT SendPacket( void* dwData, DWORD dwSize, 
  76.                                 BOOL dwGuaranteed, DWORD dwTimeout ) = 0;
  77.     virtual DWORD GetThroughputBPS() = 0;
  78.     virtual DWORD GetRoundTripLatencyMS() = 0;
  79.     virtual BOOL  IsSessionLost() = 0;
  80.     virtual DWORD GetSessionLostReason() = 0;
  81.     virtual HRESULT GetConnectionInfo( TCHAR* strConnectionInfo ) = 0;
  82. };
  83.  
  84.  
  85.  
  86. #endif
  87.