Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

ip is ready for deplyment

File size: 1.1 KB
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, int port = -1, bool resolve = true);
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    /** @returns the IP */
33    int ip() const { return this->_ip; };
34    /** @returns the Port */
35    short port() const { return this->_port; };
36
37    int ipPart(unsigned int part) const;
38    std::string ipString() const;
39
40  public:
41    static IP stringToIP(const std::string& ip, int port = -1, bool resolve = true);
42
43
44    static std::string ipToString(const IPaddress& ipaddr);
45    static std::string ipToString(int ip, int port = -1);
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.