//  Beta release only.
//
//  Copyright(c) Ivyware Pty Ltd 2005-9  (all rights reserved)
//               MELBOURNE, VICTORIA, AUSTRALIA, 3130
//
//  Provided no fee is charged (either by the distributer or user)
//  permission to use, copy, modify, and distribute this software and
//  its documentation for any purpose and without fee is hereby granted,
//  provided that the above copyright notice appear in all copies and
//  that both that copyright notice and this permission notice appear
//  in supporting documentation.
//
//  No waranty or suitablity for purpose is implied.
//
//
//  P2PeerioBSTR definitions and prototypes
//  NOTES: Manages data translation between P2PeerMsg's and BSTR type
//         formats
//       : BSTR allows data to be passed anonymously between P2PeerHub's
//         or legacy applications
//                      

#pragma once

#ifndef NO_DEBUG_NEW
#define new DEBUG_NEW
#endif

#include "P2Peerio.h"

//
//  P2PeerioBSTR protocol management
//  NOTES: Prefixes P2PeerMsg data with size of data.  Common in
//         3rd Party type protocols
class P2PmsgKERNEL_EXT P2PeerioBSTR : protected P2Peerio
{
      void
        RenderThisSafe();

    // Constructors and destructor
    public:
        P2PeerioBSTR ( );
       ~P2PeerioBSTR ( );

      virtual P2Peerio*
        Clone ( );

    // BSTR - P2PeerMsg translation
    protected:
      virtual DWORD
        SendP2PeerMsg ( HANDLE hFile
                      , P2PeerMsg *pMsg
                      , OVERLAPPEDcon *pOVERLAPPEDsend );
      virtual P2PeerMsg*
        RecvP2PeerMsg ( HANDLE hFile
                      , OVERLAPPEDcon *pOVERLAPPEDrecv );

    // Troubleshooting
    public:
      virtual void
        AssertValid ( ) const;
};
