-->
/* * Copyright 1995, 2009 Perforce Software. All rights reserved. * * This file is part of Perforce - the FAST SCM System. */ /* * NetConnect.h - RPC connection handler * * Classes Defined: * * NetIoPtrs - input/output parameters for SendOrReceive() * NetEndPoint - an endpoint for making connections * NetTransport - an RPC connection to/from a remote host * * Description: * * These classes provide abstract base classes for an endpoint for * a connection, and a connection itself. * * It should go without saying, but destructing a NetTransport must * imply a Close(). * * Public Methods: * * NetEndPoint::Listen() - set up for subsequent Accept() * NetEndPoint::ListenCheck() - see if we can listen on the given address * NetEndPoint::CheaterCheck() - check if supplied port is the licensed one * NetEndPoint::Unlisten() - cancel Listen() * NetEndPoint::Transport() - return an appropriate NetTransport * NetEndPoint::GetListenAddress() - return address suitable for Listen() * * NetTransport::Accept() - accept a single incoming connection * NetTransport::Connect() - make a single outgoing connection * NetTransport::Send() - send stream data * NetTransport::Receive() - receive stream data * NetTransport::SendOrReceive() - send or receive what's available * NetTransport::Close() - close connection * * NetTransport::GetAddress() - return connection's local address * NetTransport::GetPeerAddress() - return address of the peer * NetTransport::GetBuffering() - return transport level send buffering */ # ifndef __NETCONNECT_H__ # define __NETCONNECT_H__ # include <error.h> # define RAF_NAME 0x01 // get symbolic name # define RAF_PORT 0x02 // append port number class KeepAlive; class NetTransport; struct NetIoPtrs { char *sendPtr; char *sendEnd; char *recvPtr; char *recvEnd; } ; class NetEndPoint { public: static NetEndPoint * Create( const char *addr, Error *e ); StrPtr & GetAddress() { return service; } virtual ~NetEndPoint(); virtual StrPtr *GetListenAddress( int raf_flags ) = 0; virtual StrPtr *GetHost() = 0; virtual void Listen( Error *e ) = 0; virtual void ListenCheck( Error *e ) = 0; virtual int CheaterCheck( const char *port ) = 0; virtual void Unlisten() = 0; virtual NetTransport * Connect( Error *e ) = 0; virtual NetTransport * Accept( Error *e ) = 0; virtual int IsSingle() = 0; protected: StrBuf service; // endpoint name } ; class NetTransport : public KeepAlive { public: virtual ~NetTransport(); virtual StrPtr *GetAddress( int raf_flags ) = 0; virtual StrPtr *GetPeerAddress( int raf_flags ) = 0; virtual void Send( const char *buffer, int length, Error *e ) = 0; virtual int Receive( char *buffer, int length, Error *e ) = 0; virtual void Close() = 0; virtual void SetBreak( KeepAlive *breakCallback ) = 0; virtual int GetSendBuffering() = 0; virtual int GetRecvBuffering() = 0; // I&O virtual int SendOrReceive( NetIoPtrs &io, Error *se, Error *re ); // DO NOT USE -- experimental only! virtual int GetFd() { return -1; } } ; # endif // # ifndef __NETCONNECT_H__
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 7893 | Johan Nilsson |
OFFLINE CHANGELIST 10 - SUBMITTED ON 2011/03/23 11:18:27 Upgrade project files to VS2010 and switching to msbuild for the entire project. Retargeted everything to .NET4 Client Profile for the time being, due to VS2010 C++ limitations (can't target anything other than 4.0 without complicating the setup too much). Shouldn't be too hard to retarget later if push comes to shove. Added VS2010 P4API stuff directly inside this project also to make things easier to get up and running for the moment. Removed old static P4API libraries. ____________________________________________________________ OFFLINE CHANGELIST 9 - SUBMITTED ON 2011/03/22 07:35:31 Converted to VS2010 |