00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef __P2P_IP_HPP__
00027 #define __P2P_IP_HPP__
00028
00029 #include <ostream>
00030
00031 namespace p2p {
00032 struct ip {
00033 union {
00034 unsigned int ipl;
00035 unsigned char ipb[4];
00036 };
00037
00038 ip() : ipl(0) {}
00039 ip(unsigned int ip) : ipl(ip) {}
00040 bool operator<(const ip &ip) const { return this->ipl<ip.ipl; }
00041 bool operator>(const ip &ip) const { return this->ipl>ip.ipl; }
00042 bool operator<=(const ip &ip) const { return this->ipl<=ip.ipl; }
00043 bool operator>=(const ip &ip) const { return this->ipl>=ip.ipl; }
00044 bool operator==(const ip &ip) const { return this->ipl==ip.ipl; }
00045 bool operator!=(const ip &ip) const { return this->ipl!=ip.ipl; }
00046
00047 ip operator+(unsigned int i) const { return this->ipl+i; }
00048 ip operator-(unsigned int i) const { return this->ipl-i; }
00049 };
00050 }
00051
00052 #endif