COVISE Core
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
covise_host.h
Go to the documentation of this file.
1 /* This file is part of COVISE.
2 
3  You can use it under the terms of the GNU Lesser General Public License
4  version 2.1 or later, see lgpl-2.1.txt.
5 
6  * License: LGPL 2+ */
7 
8 #ifndef EC_HOST_H
9 #define EC_HOST_H
10 
11 #include <util/coTypes.h>
12 #include <iostream>
13 #include <string>
14 
15 namespace covise
16 {
17 
19 {
20  friend class Socket;
21 
22 private:
23  unsigned char char_address[4];
26 
29 
30  void HostNumeric(const char *n);
31  void HostSymbolic(const char *n);
32 
33  void setAddress(const char *n);
34  void setName(const char *n);
35 
36  void get_char_address(unsigned char *c) const;
37 
38  const unsigned char *get_char_address() const;
39 
40 public:
41  static std::string lookupHostname(const char *numericIp);
42  static std::string lookupIpAddress(const char *hostname);
43 
44  Host();
45  Host(const char *n, bool numeric = false);
46  Host(unsigned long a);
47  Host(const Host &h);
48  ~Host();
49 
50  Host &operator=(const Host &h);
51 
52  uint32_t get_ipv4() const;
53 
54  const char *getName() const;
55  const char *getAddress() const;
56  bool hasValidName() const;
57  bool hasValidAddress() const;
58 
59  bool hasRoutableAddress() const;
60 
61  void print()
62  {
63 #ifdef DEBUG
64  std::cerr << "Hostname: " << m_address << std::endl;
65 #endif
66  }
67 };
68 }
69 #endif
GLsizei const GLchar *const * string
Definition: khronos-glext.h:6750
GLboolean GLboolean GLboolean GLboolean a
Definition: khronos-glext.h:6895
GLfloat GLfloat GLfloat GLfloat h
Definition: khronos-glext.h:8441
const GLubyte * c
Definition: khronos-glext.h:9864
Definition: covise_host.h:18
bool m_addressValid
Definition: covise_host.h:25
Definition: covise_socket.h:125
std::string m_address
Definition: covise_host.h:24
void print()
Definition: covise_host.h:61
std::string m_name
Definition: covise_host.h:27
#define NETEXPORT
Definition: coExport.h:361
GLdouble n
Definition: khronos-glext.h:8447
bool m_nameValid
Definition: covise_host.h:28