diff options
Diffstat (limited to 'plugins/gethostbyname.h')
-rw-r--r-- | plugins/gethostbyname.h | 115 |
1 files changed, 0 insertions, 115 deletions
diff --git a/plugins/gethostbyname.h b/plugins/gethostbyname.h deleted file mode 100644 index d95ab26..0000000 --- a/plugins/gethostbyname.h +++ /dev/null | |||
@@ -1,115 +0,0 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Nagios gethostbyname_r()'s prototype. | ||
4 | * | ||
5 | * License: GPL | ||
6 | * Copyright (C) 2001,2002 Brian Stafford <brian@stafford.uklinux.net> | ||
7 | * | ||
8 | * Last Modified: $Date$ | ||
9 | * | ||
10 | * Description: | ||
11 | * | ||
12 | * This file is a ghastly hack because nobody can agree on | ||
13 | * gethostbyname_r()'s prototype. | ||
14 | * | ||
15 | * License Information: | ||
16 | * | ||
17 | * This program is free software; you can redistribute it and/or modify | ||
18 | * it under the terms of the GNU General Public License as published by | ||
19 | * the Free Software Foundation; either version 2 of the License, or | ||
20 | * (at your option) any later version. | ||
21 | * | ||
22 | * This program is distributed in the hope that it will be useful, | ||
23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
25 | * GNU General Public License for more details. | ||
26 | * | ||
27 | * You should have received a copy of the GNU General Public License | ||
28 | * along with this program; if not, write to the Free Software | ||
29 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
30 | * | ||
31 | * $Id$ | ||
32 | *****************************************************************************/ | ||
33 | |||
34 | /************************************************************************* | ||
35 | Usage: | ||
36 | |||
37 | #include <errno.h> | ||
38 | #include "gethostbyname.h" | ||
39 | |||
40 | f () | ||
41 | { | ||
42 | struct ghbnctx ctx; | ||
43 | |||
44 | errno = 0; | ||
45 | hp = gethostbyname_ctx (host, &ctx); | ||
46 | if (hp == NULL) | ||
47 | { | ||
48 | if (errno != 0) | ||
49 | handle_value_of_errno (errno); | ||
50 | else | ||
51 | handle_value_of_h_errno (h_error_ctx (&ctx)); | ||
52 | } | ||
53 | else | ||
54 | { | ||
55 | ... | ||
56 | } | ||
57 | free_ghbnctx (&ctx); | ||
58 | } | ||
59 | *************************************************************************/ | ||
60 | |||
61 | #ifndef _gethostbyname_h | ||
62 | #define _gethostbyname_h | ||
63 | |||
64 | #if HAVE_GETIPNODEBYNAME | ||
65 | |||
66 | struct ghbnctx | ||
67 | { | ||
68 | int h_err; | ||
69 | struct hostent *hostent; | ||
70 | }; | ||
71 | |||
72 | #elif HAVE_GETHOSTBYNAME_R == 6 | ||
73 | |||
74 | struct ghbnctx | ||
75 | { | ||
76 | int h_err; | ||
77 | struct hostent hostent; | ||
78 | char *hostbuf; | ||
79 | size_t hostbuf_len; | ||
80 | }; | ||
81 | |||
82 | #elif HAVE_GETHOSTBYNAME_R == 5 | ||
83 | |||
84 | struct ghbnctx | ||
85 | { | ||
86 | int h_err; | ||
87 | struct hostent hostent; | ||
88 | char *hostbuf; | ||
89 | int hostbuf_len; | ||
90 | }; | ||
91 | |||
92 | #elif HAVE_GETHOSTBYNAME_R == 3 | ||
93 | |||
94 | struct ghbnctx | ||
95 | { | ||
96 | int h_err; | ||
97 | struct hostent_data hostent_data; | ||
98 | struct hostent hostent; | ||
99 | }; | ||
100 | |||
101 | #else | ||
102 | |||
103 | struct ghbnctx | ||
104 | { | ||
105 | int h_err; | ||
106 | }; | ||
107 | |||
108 | #endif | ||
109 | |||
110 | struct hostent *gethostbyname_ctx (const char *host, struct ghbnctx *ctx); | ||
111 | int h_error_ctx (struct ghbnctx *ctx); | ||
112 | void free_ghbnctx (struct ghbnctx *ctx); | ||
113 | |||
114 | #endif | ||
115 | |||