Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/proxy/src/lib/network/ip.h @ 9306

Last change on this file since 9306 was 9306, checked in by bensch, 18 years ago

orxonox/proxy: ip class ok now

File size: 937 bytes
Line 
1
2/*!
3 * @file ip.h
4 *
5 * @brief the ip class is used to transform strings to ip's and backwards
6 * it can also be used to
7 *
8 */
9
10#ifndef __IP_H__
11#define __IP_H__
12
13#include <string>
14
15#include "netdefs.h"
16
17
18//! A class to handle time itself
19class IP
20{
21  public:
22    IP();
23    IP(const std::string& ip);
24    IP(int ip, int port);
25    IP(const IPaddress& ip);
26    IP(const IP& ip);
27
28    const IP& operator=(const IP& ip);
29    bool operator==(const IP& ip);
30
31
32    int ip() const { return this->_ip; };
33    short port() const { return this->_port; };
34
35    int ipPart(unsigned int part) const;
36    std::string ipString() const;
37
38
39
40  public:
41    static IP stringToIP(const std::string& ip);
42
43
44    static std::string ipToString(const IPaddress& ipaddr);
45    static std::string ipToString(int ip);
46
47  private:
48    int           _ip;    //!< The IP in int form.
49    short         _port;  //!< The Port number of the IP
50
51};
52
53#endif /* __IP_H__ */
Note: See TracBrowser for help on using the repository browser.