00001 /***************************** License ********************************** 00002 00003 Copyright (C) 2008 by Communicative Machines 00004 http://www.cmlabs.com All rights reserved. 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Lesser General Public 00008 License as published by the Free Software Foundation; either 00009 version 2.1 of the License, or (at your option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Lesser General Public License for more details. 00015 00016 You should have received a copy of the GNU Lesser General Public 00017 License along with this library; if not, write to the Free Software 00018 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 00020 ************************************************************************/ 00021 00022 00023 // TCPLocation.h: interface for the TCPLocation class. 00024 // 00025 ////////////////////////////////////////////////////////////////////// 00026 00027 #if !defined(AFX_TCPLOCATION_H__38AB0349_6FF9_4354_890F_32E68B0DD66C__INCLUDED_) 00028 #define AFX_TCPLOCATION_H__38AB0349_6FF9_4354_890F_32E68B0DD66C__INCLUDED_ 00029 00030 #if _MSC_VER > 1000 00031 #pragma once 00032 #endif // _MSC_VER > 1000 00033 00034 #include "Object.h" 00035 #include "JString.h" 00036 #include "XMLParser.h" 00037 00038 namespace cmlabs { 00039 00040 #define NO_LISTEN -1 00041 00042 typedef struct _IPNumber 00043 { 00044 unsigned char a; 00045 unsigned char b; 00046 unsigned char c; 00047 unsigned char d; 00048 } IPNumber; 00049 00050 class TCPLocation : public Object 00051 { 00052 public: 00053 TCPLocation(); 00054 // TCPLocation(TCPLocation &loc); 00055 TCPLocation(const JString& xml); 00056 TCPLocation(XMLNode* node); 00057 TCPLocation(const JString& str, const JString& alias); 00058 TCPLocation(const JString& str, int portNum); 00059 TCPLocation(const JString& str, int portNum, const JString& alias); 00060 virtual ~TCPLocation(); 00061 00062 Object* clone() const; 00063 bool equals(const TCPLocation& loc) const; 00064 //! Get total size of payload 00065 virtual unsigned long getPayloadSize() const; 00066 bool isValid() const; 00067 JString asText() const; 00068 JString getLocation() const; 00069 JString toXML() ; 00070 bool fromXML(const JString& xml); 00071 bool fromXML(XMLNode* node); 00072 bool set(const JString& str); 00073 JString print(); 00074 JString printList(); 00075 Collection getAllAddresses(); 00076 00077 bool setIPAddress(JString ip); 00078 JString getIPAddress() const; 00079 00080 bool isNoListen() const; 00081 00082 bool isConnectedViaCNS; 00083 JString addr; 00084 int port; 00085 JString name; 00086 JString regID; 00087 JString authentication; 00088 JString additional; 00089 00090 JString procid; 00091 void* pCommunicator; 00092 IPNumber ipnumber; 00093 JString netProtocolName; 00094 00095 }; 00096 00097 } // namespace cmlabs 00098 00099 #endif // !defined(AFX_TCPLOCATION_H__38AB0349_6FF9_4354_890F_32E68B0DD66C__INCLUDED_)