00001 // Wolf for J2K Library 00002 // LGPL Licensed. 00003 // http://j2k.sourceforge.net/ 00004 // Revision #1: Fred P. - Oct 2nd, 2001 00005 00006 #ifndef __J2K__NET__INETADDRESS_HPP__ 00007 #define __J2K__NET__INETADDRESS_HPP__ 00008 00009 #include <j2k/Net/include.hpp> 00010 00011 #include <errno.h> 00012 #include <string.h> 00013 00014 // This is the InetAddress class in java.net. 00015 // It implements an IPv4 address 00016 00017 class InetAddress 00018 { 00019 public: 00020 InetAddress(); 00021 InetAddress( const InetAddress& src ); 00022 const InetAddress& operator=( const InetAddress& src ); 00023 00024 #ifdef USE_JSTRING 00025 00026 InetAddress( const JString& hostname ); 00027 00028 JString getHostAddress() const; 00029 JString getHostName() const; 00030 void setAddress( const JString& hostname); 00031 00032 JString toString() const; 00033 00034 //return a pointer to array of InetAddress objects 00035 const InetAddress* getAllByName( const JString& host) const; 00036 const InetAddress getByName( const JString& host) const; 00037 00038 #else 00039 00040 InetAddress( const char *hostname ); 00041 00042 const char* getHostAddress() const; 00043 const char* getHostName() const; 00044 void setAddress( const char *hostname); 00045 00046 const char* toString() const; 00047 00048 const InetAddress getByName( const char* host ) const; 00049 00050 #endif 00051 00052 const InetAddress* getAllByName( const char* host ) const; 00053 00054 BOOL equals( const InetAddress& right ) const; 00055 BOOL operator==( const InetAddress& right ) const; 00056 const char* getAddress() const; 00057 unsigned long getAddress2() const; 00058 00059 BOOL isMulticastAddress() const; 00060 00061 // Not sure about this... const InetAddress& ?? 00062 static InetAddress InetAddress::getLocalHost() 00063 { 00064 static InetAddress I; 00065 return I; 00066 } 00067 00068 private: 00069 00070 struct in_addr* ip; 00071 struct hostent* h; 00072 }; 00073 00074 #endif //__J2K__NET__INETADDRESS_HPP__