source: src/addrinfo_hostent.h @ 6bb9a6

Revision 6bb9a6, 1.6 KB checked in by Tomash Brechko <tomash.brechko@…>, 3 years ago (diff)

On systems lacking getaddrinfo() implement it with gethostbyname().

Problem report and initial patch are by Yasuhiro Matsumoto.

  • Property mode set to 100644
Line 
1/*
2  Copyright (C) 2009 Tomash Brechko.  All rights reserved.
3
4  When used to build Perl module:
5
6  This library is free software; you can redistribute it and/or modify
7  it under the same terms as Perl itself, either Perl version 5.8.8
8  or, at your option, any later version of Perl 5 you may have
9  available.
10
11  When used as a standalone library:
12
13  This library is free software; you can redistribute it and/or modify
14  it under the terms of the GNU Lesser General Public License as
15  published by the Free Software Foundation; either version 2.1 of the
16  License, or (at your option) any later version.
17
18  This library is distributed in the hope that it will be useful, but
19  WITHOUT ANY WARRANTY; without even the implied warranty of
20  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21  Lesser General Public License for more details.
22*/
23
24#ifndef ADDRINFO_HOSTENT_H
25#define ADDRINFO_HOSTENT_H 1
26
27#ifndef WIN32
28#include <netdb.h>
29#else  /* WIN32 */
30#include <ws2tcpip.h>
31#endif  /* WIN32 */
32
33
34#undef addrinfo
35#define addrinfo  addrinfo_hostent
36
37#undef getaddrinfo
38#define getaddrinfo  getaddrinfo_hostent
39
40#undef freeaddrinfo
41#define freeaddrinfo  freeaddrinfo_hostent
42
43
44struct addrinfo_hostent
45{
46  int ai_flags;
47  int ai_family;
48  int ai_socktype;
49  int ai_protocol;
50  size_t ai_addrlen;
51  struct sockaddr *ai_addr;
52  char *ai_canonname;
53
54  struct addrinfo_hostent *ai_next;
55};
56
57
58extern
59int
60getaddrinfo_hostent(const char *node, const char *service,
61                    const struct addrinfo_hostent *hints,
62                    struct addrinfo_hostent **res);
63
64extern
65void
66freeaddrinfo_hostent(struct addrinfo_hostent *res);
67
68
69#endif  /* ! ADDRINFO_HOSTENT_H */
Note: See TracBrowser for help on using the repository browser.