1/*- 2 * Copyright (C) 2005 The FreeBSD Project. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * 2. Redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution. 12 * 13 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 14 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23 * SUCH DAMAGE. 24 *
| 1/*- 2 * Copyright (C) 2005 The FreeBSD Project. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * 2. Redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution. 12 * 13 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 14 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23 * SUCH DAMAGE. 24 *
|
25 * $FreeBSD: head/lib/libc/net/netdb_private.h 145635 2005-04-28 18:52:40Z ume $
| 25 * $FreeBSD: head/lib/libc/net/netdb_private.h 146244 2005-05-15 20:15:15Z ume $
|
26 */ 27 28#ifndef _NETDB_PRIVATE_H_ 29#define _NETDB_PRIVATE_H_ 30
| 26 */ 27 28#ifndef _NETDB_PRIVATE_H_ 29#define _NETDB_PRIVATE_H_ 30
|
31#include <sys/_types.h>
| |
32#include <stdio.h> /* XXX: for FILE */ 33
| 31#include <stdio.h> /* XXX: for FILE */ 32
|
34#ifndef _UINT32_T_DECLARED 35typedef __uint32_t uint32_t; 36#define _UINT32_T_DECLARED 37#endif 38
| |
39#define _MAXALIASES 35 40#define _MAXLINELEN 1024 41#define _MAXADDRS 35 42#define _HOSTBUFSIZE (8 * 1024) 43#define _NETBUFSIZE 1025 44 45struct hostent_data { 46 uint32_t host_addr[4]; /* IPv4 or IPv6 */ 47 char *h_addr_ptrs[_MAXADDRS + 1]; 48 char *host_aliases[_MAXALIASES]; 49 char hostbuf[_HOSTBUFSIZE]; 50 FILE *hostf; 51 int stayopen; 52#ifdef YP 53 char *yp_domain; 54#endif 55}; 56 57struct netent_data { 58 char *net_aliases[_MAXALIASES]; 59 char netbuf[_NETBUFSIZE]; 60 FILE *netf; 61 int stayopen; 62#ifdef YP 63 char *yp_domain; 64#endif 65}; 66 67struct protoent_data { 68 FILE *fp; 69 char *aliases[_MAXALIASES]; 70 int stayopen; 71 char line[_MAXLINELEN + 1]; 72}; 73 74struct servent_data { 75 FILE *fp; 76 char *aliases[_MAXALIASES]; 77 int stayopen; 78 char line[_MAXLINELEN + 1]; 79#ifdef YP 80 int yp_stepping; 81 char *yp_name; 82 char *yp_proto; 83 int yp_port; 84 char *yp_domain; 85 char *yp_key; 86 int yp_keylen; 87#endif 88}; 89 90struct hostdata { 91 struct hostent host; 92 struct hostent_data data; 93}; 94 95struct netdata { 96 struct netent net; 97 struct netent_data data; 98}; 99 100struct protodata { 101 struct protoent proto; 102 struct protoent_data data; 103}; 104 105struct servdata { 106 struct servent serv; 107 struct servent_data data; 108}; 109 110#define endhostent_r __endhostent_r 111#define endnetent_r __endnetent_r 112#define endprotoent_r __endprotoent_r 113#define endservent_r __endservent_r 114#define gethostbyaddr_r __gethostbyaddr_r 115#define gethostbyname_r __gethostbyname_r 116#define gethostbyname2_r __gethostbyname2_r 117#define gethostent_r __gethostent_r 118#define getnetbyaddr_r __getnetbyaddr_r 119#define getnetbyname_r __getnetbyname_r 120#define getnetent_r __getnetent_r 121#define getprotobyname_r __getprotobyname_r 122#define getprotobynumber_r __getprotobynumber_r 123#define getprotoent_r __getprotoent_r 124#define getservbyname_r __getservbyname_r 125#define getservbyport_r __getservbyport_r 126#define getservent_r __getservent_r 127#define sethostent_r __sethostent_r 128#define setnetent_r __setnetent_r 129#define setprotoent_r __setprotoent_r 130#define setservent_r __setservent_r 131 132struct hostdata *__hostdata_init(void); 133struct netdata *__netdata_init(void); 134struct protodata *__protodata_init(void); 135struct servdata *__servdata_init(void); 136void _endhostdnsent(void); 137void _endhosthtent(struct hostent_data *); 138void _endnetdnsent(void); 139void _endnethtent(struct netent_data *); 140struct hostent *_gethostbynisaddr(const char *, int, int); 141struct hostent *_gethostbynisname(const char *, int); 142void _map_v4v6_address(const char *, char *); 143void _map_v4v6_hostent(struct hostent *, char **, char *); 144void _sethostdnsent(int); 145void _sethosthtent(int, struct hostent_data *); 146void _setnetdnsent(int); 147void _setnethtent(int, struct netent_data *); 148void endhostent_r(struct hostent_data *); 149void endnetent_r(struct netent_data *); 150void endprotoent_r(struct protoent_data *); 151void endservent_r(struct servent_data *); 152int gethostbyaddr_r(const char *, int, int, struct hostent *, 153 struct hostent_data *); 154int gethostbyname_r(const char *, struct hostent *, struct hostent_data *); 155int gethostbyname2_r(const char *, int, struct hostent *, 156 struct hostent_data *); 157int gethostent_r(struct hostent *, struct hostent_data *);
| 33#define _MAXALIASES 35 34#define _MAXLINELEN 1024 35#define _MAXADDRS 35 36#define _HOSTBUFSIZE (8 * 1024) 37#define _NETBUFSIZE 1025 38 39struct hostent_data { 40 uint32_t host_addr[4]; /* IPv4 or IPv6 */ 41 char *h_addr_ptrs[_MAXADDRS + 1]; 42 char *host_aliases[_MAXALIASES]; 43 char hostbuf[_HOSTBUFSIZE]; 44 FILE *hostf; 45 int stayopen; 46#ifdef YP 47 char *yp_domain; 48#endif 49}; 50 51struct netent_data { 52 char *net_aliases[_MAXALIASES]; 53 char netbuf[_NETBUFSIZE]; 54 FILE *netf; 55 int stayopen; 56#ifdef YP 57 char *yp_domain; 58#endif 59}; 60 61struct protoent_data { 62 FILE *fp; 63 char *aliases[_MAXALIASES]; 64 int stayopen; 65 char line[_MAXLINELEN + 1]; 66}; 67 68struct servent_data { 69 FILE *fp; 70 char *aliases[_MAXALIASES]; 71 int stayopen; 72 char line[_MAXLINELEN + 1]; 73#ifdef YP 74 int yp_stepping; 75 char *yp_name; 76 char *yp_proto; 77 int yp_port; 78 char *yp_domain; 79 char *yp_key; 80 int yp_keylen; 81#endif 82}; 83 84struct hostdata { 85 struct hostent host; 86 struct hostent_data data; 87}; 88 89struct netdata { 90 struct netent net; 91 struct netent_data data; 92}; 93 94struct protodata { 95 struct protoent proto; 96 struct protoent_data data; 97}; 98 99struct servdata { 100 struct servent serv; 101 struct servent_data data; 102}; 103 104#define endhostent_r __endhostent_r 105#define endnetent_r __endnetent_r 106#define endprotoent_r __endprotoent_r 107#define endservent_r __endservent_r 108#define gethostbyaddr_r __gethostbyaddr_r 109#define gethostbyname_r __gethostbyname_r 110#define gethostbyname2_r __gethostbyname2_r 111#define gethostent_r __gethostent_r 112#define getnetbyaddr_r __getnetbyaddr_r 113#define getnetbyname_r __getnetbyname_r 114#define getnetent_r __getnetent_r 115#define getprotobyname_r __getprotobyname_r 116#define getprotobynumber_r __getprotobynumber_r 117#define getprotoent_r __getprotoent_r 118#define getservbyname_r __getservbyname_r 119#define getservbyport_r __getservbyport_r 120#define getservent_r __getservent_r 121#define sethostent_r __sethostent_r 122#define setnetent_r __setnetent_r 123#define setprotoent_r __setprotoent_r 124#define setservent_r __setservent_r 125 126struct hostdata *__hostdata_init(void); 127struct netdata *__netdata_init(void); 128struct protodata *__protodata_init(void); 129struct servdata *__servdata_init(void); 130void _endhostdnsent(void); 131void _endhosthtent(struct hostent_data *); 132void _endnetdnsent(void); 133void _endnethtent(struct netent_data *); 134struct hostent *_gethostbynisaddr(const char *, int, int); 135struct hostent *_gethostbynisname(const char *, int); 136void _map_v4v6_address(const char *, char *); 137void _map_v4v6_hostent(struct hostent *, char **, char *); 138void _sethostdnsent(int); 139void _sethosthtent(int, struct hostent_data *); 140void _setnetdnsent(int); 141void _setnethtent(int, struct netent_data *); 142void endhostent_r(struct hostent_data *); 143void endnetent_r(struct netent_data *); 144void endprotoent_r(struct protoent_data *); 145void endservent_r(struct servent_data *); 146int gethostbyaddr_r(const char *, int, int, struct hostent *, 147 struct hostent_data *); 148int gethostbyname_r(const char *, struct hostent *, struct hostent_data *); 149int gethostbyname2_r(const char *, int, struct hostent *, 150 struct hostent_data *); 151int gethostent_r(struct hostent *, struct hostent_data *);
|
158int getnetbyaddr_r(unsigned long addr, int af, struct netent *,
| 152int getnetbyaddr_r(uint32_t addr, int af, struct netent *,
|
159 struct netent_data *); 160int getnetbyname_r(const char *, struct netent *, struct netent_data *); 161int getnetent_r(struct netent *, struct netent_data *); 162int getprotobyname_r(const char *, struct protoent *, struct protoent_data *); 163int getprotobynumber_r(int, struct protoent *, struct protoent_data *); 164int getprotoent_r(struct protoent *, struct protoent_data *); 165int getservbyname_r(const char *, const char *, struct servent *, 166 struct servent_data *); 167int getservbyport_r(int, const char *, struct servent *, 168 struct servent_data *); 169int getservent_r(struct servent *, struct servent_data *); 170void sethostent_r(int, struct hostent_data *); 171void setnetent_r(int, struct netent_data *); 172void setprotoent_r(int, struct protoent_data *); 173void setservent_r(int, struct servent_data *); 174 175#endif /* _NETDB_PRIVATE_H_ */
| 153 struct netent_data *); 154int getnetbyname_r(const char *, struct netent *, struct netent_data *); 155int getnetent_r(struct netent *, struct netent_data *); 156int getprotobyname_r(const char *, struct protoent *, struct protoent_data *); 157int getprotobynumber_r(int, struct protoent *, struct protoent_data *); 158int getprotoent_r(struct protoent *, struct protoent_data *); 159int getservbyname_r(const char *, const char *, struct servent *, 160 struct servent_data *); 161int getservbyport_r(int, const char *, struct servent *, 162 struct servent_data *); 163int getservent_r(struct servent *, struct servent_data *); 164void sethostent_r(int, struct hostent_data *); 165void setnetent_r(int, struct netent_data *); 166void setprotoent_r(int, struct protoent_data *); 167void setservent_r(int, struct servent_data *); 168 169#endif /* _NETDB_PRIVATE_H_ */
|