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