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 
14 namespace covise
15 {
16 
18 {
19  friend class Socket;
20 
21 private:
22  unsigned char char_address[4];
23 
24  char *address;
26 
27  char *name;
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  return (unsigned char *)char_address;
41  }
42 
43 public:
44  static std::string lookupHostname(const char *numericIp);
45  static std::string lookupIpAddress(const char *hostname);
46 
47  Host();
48  Host(const char *n, bool numeric = false);
49  Host(unsigned long a);
50  Host(const Host &h);
51  ~Host();
52 
53  Host &operator=(const Host &h);
54 
55  uint32_t get_ipv4() const;
56 
57  const char *getName() const
58  {
59  return name;
60  }
61  const char *getAddress() const
62  {
63  return address;
64  }
65  bool hasValidName() const;
66  bool hasValidAddress() const;
67 
68  bool hasRoutableAddress() const;
69 
70  void print()
71  {
72 #ifdef DEBUG
73  std::cerr << "Hostname: " << address << std::endl;
74 #endif
75  }
76 };
77 }
78 #endif
GLfloat GLfloat GLfloat GLfloat h
Definition: khronos-glext.h:8441
Definition: covise_host.h:17
char * name
Definition: covise_host.h:27
bool m_nameValid
Definition: covise_host.h:28
GLuint const GLchar * name
Definition: khronos-glext.h:6722
GLdouble n
Definition: khronos-glext.h:8447
GLsizei const GLchar *const * string
Definition: khronos-glext.h:6750
Definition: covise_socket.h:125
const char * getName() const
Definition: covise_host.h:57
const char * getAddress() const
Definition: covise_host.h:61
const unsigned char * get_char_address() const
Definition: covise_host.h:38
const GLubyte * c
Definition: khronos-glext.h:9864
char * address
Definition: covise_host.h:24
GLboolean GLboolean GLboolean GLboolean a
Definition: khronos-glext.h:6895
void print()
Definition: covise_host.h:70
GLuint address
Definition: khronos-glext.h:10368
#define NETEXPORT
Definition: coExport.h:343
bool m_addressValid
Definition: covise_host.h:25