Rudiments
hostentry.h
1 // Copyright (c) 2002 David Muse
2 // See the COPYING file for more information.
3 
4 #ifndef RUDIMENTS_HOSTENTRY_H
5 #define RUDIMENTS_HOSTENTRY_H
6 
7 #include <rudiments/private/hostentryincludes.h>
8 
9 #ifdef RUDIMENTS_NAMESPACE
10 namespace rudiments {
11 #endif
12 
13 class hostentryprivate;
14 
17 class RUDIMENTS_DLLSPEC hostentry {
18  public:
19 
26  static bool getAliasList(const char *hostname,
27  char ***aliaslist);
28 
30  static bool getAddressType(const char *hostname,
31  int32_t *addresstype);
32 
35  static bool getAddressLength(const char *hostname,
36  int32_t *addresslength);
37 
46  static bool getAddressList(const char *hostname,
47  char ***addresslist);
48 
53  static bool getAddressString(const char *hostname,
54  int32_t index,
55  char **addressstring);
56 
65  static bool getName(const char *address,
66  int32_t len, int32_t type,
67  char **name);
68 
78  static bool getAliasList(const char *address,
79  int32_t len, int32_t type,
80  char ***aliaslist);
81 
91  static bool getAddressList(const char *address,
92  int32_t len, int32_t type,
93  char ***addresslist);
94 
103  static bool getAddressString(const char *address,
104  int32_t len, int32_t type,
105  int32_t index,
106  char **addressstring);
107 
109  hostentry();
110 
113  hostentry(const hostentry &h);
114 
117  hostentry &operator=(const hostentry &h);
118 
120  ~hostentry();
121 
123  bool initialize(const char *hostname);
124 
129  bool initialize(const char *address,
130  int32_t len, int32_t type);
131 
133  const char *getName() const;
134 
137  const char * const *getAliasList() const;
138 
140  int32_t getAddressType() const;
141 
143  int32_t getAddressLength() const;
144 
147  const char * const *getAddressList() const;
148 
153  char *getAddressString(int32_t index) const;
154 
156  void print() const;
157 
160  static bool needsMutex();
161 
165  static void setMutex(mutex *mtx);
166 
167  #include <rudiments/private/hostentry.h>
168 };
169 
170 #ifdef RUDIMENTS_NAMESPACE
171 }
172 #endif
173 
174 #endif