diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | bcb704366cb5e333a626c18c308c7e0448a8e69f (patch) | |
tree | f0d6ab7d78ecdd9207cf46536376b44b91a1ca71 /lanbrowsing/lisa/ipaddress.h | |
download | tdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.tar.gz tdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'lanbrowsing/lisa/ipaddress.h')
-rw-r--r-- | lanbrowsing/lisa/ipaddress.h | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/lanbrowsing/lisa/ipaddress.h b/lanbrowsing/lisa/ipaddress.h new file mode 100644 index 00000000..ecca928a --- /dev/null +++ b/lanbrowsing/lisa/ipaddress.h @@ -0,0 +1,55 @@ +/* ipaddress.h + * + * Copyright (c) 1998, 1999, Alexander Neundorf, Lukas Pustina + * + * You may distribute under the terms of the GNU General Public + * License as specified in the COPYING file. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#ifndef IPADDRESS_H +#define IPADDRESS_H + +#include "lisadefines.h" + +#include <sys/types.h> +#include <netinet/in.h> +#include <arpa/inet.h> +#include <stdlib.h> +#include "mystring.h" + +class IPAddress +{ + public: + IPAddress(); + IPAddress(const MyString& ip); + IPAddress(unsigned int ip); + IPAddress(struct in_addr ip); + IPAddress(int b1, int b2, int b3, int b4); + //you know + MyString asString() {return s;}; + //in host byte order + unsigned int asInt() {return i;}; + //in network byte order + struct in_addr asStruct() {return n;}; + /*operator= (IPAddress ip); + operator+= (unsigned int add);*/ + void print(); + private: + MyString int2String(unsigned int ip); + MyString struct2String(struct in_addr ip); + unsigned int string2Int(MyString ip); + struct in_addr string2Struct(MyString ip); + MyString s; + unsigned int i; + struct in_addr n; +}; + +#endif |