COVISE Core
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
15namespace covise
16{
17
19{
20 friend class Socket;
21
22private:
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
40public:
41 static std::string lookupHostname(const char *numericIp);
42 static std::string lookupIpAddress(const char *hostname);
43 static const std::string &getHostname();
44 static const std::string &getHostaddress();
45 static const std::string &getUsername();
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 const char *getAddress() const;
59 bool hasValidName() const;
60 bool hasValidAddress() const;
61
62 bool hasRoutableAddress() const;
63
64 void print()
65 {
66#ifdef DEBUG
67 std::cerr << "Hostname: " << m_address << std::endl;
68#endif
69 }
70};
71}
72#endif
#define NETEXPORT
Definition: coExport.h:373
GLsizei const GLchar *const * string
Definition: khronos-glext.h:6750
GLdouble n
Definition: khronos-glext.h:8447
const GLubyte * c
Definition: khronos-glext.h:9864
GLboolean GLboolean GLboolean GLboolean a
Definition: khronos-glext.h:6895
GLfloat GLfloat GLfloat GLfloat h
Definition: khronos-glext.h:8441
list of all chemical elements
Definition: coConfig.h:27
Definition: covise_host.h:19
bool m_nameValid
Definition: covise_host.h:28
bool m_addressValid
Definition: covise_host.h:25
std::string m_address
Definition: covise_host.h:24
void print()
Definition: covise_host.h:64
std::string m_name
Definition: covise_host.h:27
Definition: covise_socket.h:129