00001 /* 00002 * synergy -- mouse and keyboard sharing utility 00003 * Copyright (C) 2002 Chris Schoeneman 00004 * 00005 * This package is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU General Public License 00007 * found in the file COPYING that should have accompanied this file. 00008 * 00009 * This package is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 */ 00014 00015 #ifndef CNETWORKADDRESS_H 00016 #define CNETWORKADDRESS_H 00017 00018 #include "CString.h" 00019 #include "BasicTypes.h" 00020 #include "IArchNetwork.h" 00021 00023 00026 class CNetworkAddress { 00027 public: 00031 CNetworkAddress(); 00032 00037 CNetworkAddress(int port); 00038 00049 CNetworkAddress(const CString& hostname, int port); 00050 00051 CNetworkAddress(const CNetworkAddress&); 00052 00053 ~CNetworkAddress(); 00054 00055 CNetworkAddress& operator=(const CNetworkAddress&); 00056 00058 00059 00061 00067 void resolve(); 00068 00070 00071 00072 00074 00077 bool operator==(const CNetworkAddress& address) const; 00078 00080 00083 bool operator!=(const CNetworkAddress& address) const; 00084 00086 00089 bool isValid() const; 00090 00092 00096 const CArchNetAddress& getAddress() const; 00097 00099 00103 int getPort() const; 00104 00106 00109 CString getHostname() const; 00110 00112 00113 private: 00114 void checkPort(); 00115 00116 private: 00117 CArchNetAddress m_address; 00118 CString m_hostname; 00119 int m_port; 00120 }; 00121 00122 #endif