VR-Link API Documentation for HLA 1.3
vlInetEndpoint.h
Go to the documentation of this file.
00001 /*********************************************************************
00002 ** Copyright (c) 1992-2010 VT MAK
00003 ** All rights reserved.
00004 *********************************************************************/
00008 #pragma once
00009 
00010 #include <vlutil/vlInet.h>
00011 #include <vlutil/vlInetAddr.h>
00012 #include <vlutil/vlInetAddrUtils.h>
00013 #include <vlutil/vlString.h>
00014 
00015 
00016 #ifdef DtUSE_UTILITIES_NAMESPACE
00017 namespace DtUSE_UTILITIES_NAMESPACE
00018 {
00019 #endif
00020 
00022 enum DtInetProtocol
00023 {
00024    DtInetProtocol_UDP = 0,
00025    DtInetProtocol_TCP = 1,
00026    DtInetProtocol_Unspecified = 99
00027 };
00028 
00033 class DT_DLL_VLUTIL DtInetEndpoint
00034 {
00035 public:
00036     
00038    DtInetEndpoint();
00039 
00049    //  with. If addr specifies a remote unicast address, broadcast address, or
00053    DtInetEndpoint( const DtInetAddr& addr, DtU16 port = 0,
00054       DtInetProtocol protocol = DtInetProtocol_Unspecified);
00055 
00072    //  with. If the network resource locator resolves to a remote unicast 
00076    DtInetEndpoint( DtString& netResLoc, DtU16 port = 0, 
00077       DtInetProtocol protocol = DtInetProtocol_Unspecified,
00078       DtInetUtils::DtInetAddrFamily familyHint = DtInetUtils::DtInetAddrFamily_IPv4 );
00079 
00081    virtual ~DtInetEndpoint();
00082 
00084    DtInetEndpoint( const DtInetEndpoint& orig );
00085 
00087    DtInetEndpoint& operator=(const DtInetEndpoint& orig);
00088 
00092    virtual void hostLookup( DtString& addr, DtU16 port = 0,
00093                DtInetUtils::DtInetAddrFamily familyHint = DtInetUtils::DtInetAddrFamily_Both );
00094 
00098    virtual void setAddress( const DtInetAddr& addr );
00099    virtual const DtInetAddr& address() const;
00100 
00104    virtual void setPort( DtU16 port );
00105    virtual DtU16 port() const;
00106 
00112    virtual void setProtocol( DtInetProtocol protocol );
00113    virtual DtInetProtocol protocol() const;
00114 
00116    virtual DtInetUtils::DtInetAddrFamily family() const;
00117 
00120    virtual void setEndpoint( DtInetProtocol protocol, const DtInetAddr& addr, DtU16 port );
00121 
00124    virtual bool isIPv4() const;
00125    virtual bool isIPv6() const;
00126    virtual bool isTcp() const;
00127    virtual bool isUdp() const;
00129 
00133    virtual int toSockaddr( struct sockaddr_in* s );
00134    virtual int toSockaddr( struct sockaddr_in6* s );
00136 
00146    virtual const DtString& toDtString( bool showProtocol = false ) const;
00147 
00150    virtual bool isOk();
00151 
00153    virtual DtString getLastErrorString();
00154 
00155 
00157    virtual void* tcpEndpoint();
00158    virtual void* udpEndpoint();
00159 
00162    friend DT_DLL_VLUTIL bool operator==( const DtInetEndpoint& ep1, const DtInetEndpoint& ep2 );
00163    friend DT_DLL_VLUTIL bool operator!=( const DtInetEndpoint& ep1, const DtInetEndpoint& ep2 );
00164    friend DT_DLL_VLUTIL bool operator<( const DtInetEndpoint& ep1, const DtInetEndpoint& ep2 );
00165    friend DT_DLL_VLUTIL bool operator>( const DtInetEndpoint& ep1, const DtInetEndpoint& ep2 );
00166 //   virtual bool operator==( const DtInetEndpoint& addr );
00168 
00169 protected:
00170    void initEndpoint();
00171 
00172 protected:
00173    void* myTcpEndpoint;
00174    void* myUdpEndpoint;
00175 
00176    DtInetAddr     myAddr;
00177    DtU16          myPort;
00178    DtInetProtocol myProtocol;
00179 
00180    bool       myError;
00181    DtString   myLastErrorString;
00182 
00186    mutable bool myMutableStringsInitialized;
00187    mutable DtString   myMutableShortString;
00188    mutable DtString   myMutableFullString;
00189 
00190    DtString   myNodeName;
00191 
00192 }; 
00193 // end of class DtInetEndpoint
00194 
00195 #ifdef DtUSE_UTILITIES_NAMESPACE
00196 } 
00197 #endif
00198 

Document ID: Generated on Mon May 14 08:06:18 EDT 2012 from SVN revision 114750
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)