diff options
author | stevel@tonic-gate <none@none> | 2005-06-14 00:00:00 -0700 |
---|---|---|
committer | stevel@tonic-gate <none@none> | 2005-06-14 00:00:00 -0700 |
commit | 7c478bd95313f5f23a4c958a745db2134aa03244 (patch) | |
tree | c871e58545497667cbb4b0a4f2daf204743e1fe7 /usr/src/lib/libresolv2/include | |
download | illumos-joyent-7c478bd95313f5f23a4c958a745db2134aa03244.tar.gz |
OpenSolaris Launch
Diffstat (limited to 'usr/src/lib/libresolv2/include')
34 files changed, 3647 insertions, 0 deletions
diff --git a/usr/src/lib/libresolv2/include/Makefile b/usr/src/lib/libresolv2/include/Makefile new file mode 100644 index 0000000000..65931f43f0 --- /dev/null +++ b/usr/src/lib/libresolv2/include/Makefile @@ -0,0 +1,41 @@ +# +# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" +# + +include ../../../Makefile.master + +HDRS= os_version.h port_ipv6.h +TMPHDRS= new_os_version.h new_port_ipv6.h + +all := TARGET= all +clean := TARGET= clean +clobber := TARGET= clobber +install := TARGET= install + +.KEEP_STATE: + +all lint: $(HDRS) + +install: all + +clean: + $(RM) $(HDRS) $(TMPHDRS) + +clobber: clean + +# os_version.h and port_ipv6.h should be rebuilt when you change OS +# revision. Since that's not easily expressed as a dependency, we +# rebuild them every time. + +os_version.h: make_os_version FRC + $(CHMOD) a+x make_os_version + ./make_os_version + +port_ipv6.h: probe_ipv6 FRC + $(CHMOD) a+x probe_ipv6 + CC="$(CC)" ./probe_ipv6 + +FRC: diff --git a/usr/src/lib/libresolv2/include/conf/sunoptions.h b/usr/src/lib/libresolv2/include/conf/sunoptions.h new file mode 100644 index 0000000000..9e4257b81d --- /dev/null +++ b/usr/src/lib/libresolv2/include/conf/sunoptions.h @@ -0,0 +1,63 @@ +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SUNOPTIONS_H +#define _SUNOPTIONS_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * The following options are PP flags available in the reference implementation + * but do not get compiled due to the elimination of the options.h file + * This section selectively reintroduces them + */ + +#define HAVE_GETRUSAGE + +/* + * The following options are PP flags introduced as part of the Sun/Solaris + * port. + */ + +/* We may have to pull this out */ +#define SUNW_LIBNSL /* conflicts for inet_addr, inet_ntoa */ + +/* Additions for Solaris 2 */ +#define SUNW_NSSEARCH /* fix nslookup domain search */ +#define SUNW_AVOIDOVERFLOW /* Avoid buffer overflows */ +#define SUNW_INITCHKIF /* Check if any non-loopback interface is up */ +#define SUNW_DOMAINFROMNIS /* Default domain name from NIS/NIS+ */ +#define USELOOPBACK /* Resolver library defaults to 127.0.0.1 */ +#define SUNW_CONFCHECK /* Abort quickly if no /etc/resolv.conf or local */ + /* named */ +#define SUNW_AREWEINNAMED /* Override _confcheck if proc is in.named */ +#define SUNW_OPENFDOFFSET /* Open non-stdio fd:s with offset */ +#define SUNW_POLL /* Use poll(2) instead of select(3) */ +#define SUNW_SYNONYMS /* Include synonyms.h (libresolv) */ +#define SUNW_HOSTS_FALLBACK /* Configurable /etc/hosts fallback */ +#define SUNW_LISTEN_BACKLOG /* Configurable listen(3N) backlog (named) */ +#define SUNW_REJECT_BOGUS_H_LENGTH /* (libresolv) */ +#define SUNW_HNOK_UNDERSCORE /* Allow underscore in hostnames (libresolv) */ +#define SUNW_MT_RESOLVER /* MT hot extensions (libresolv) */ +#define SUNW_QSTREAM_CLEANUP /* Avoid using free()d struct qstreams */ +#define SUNW_SETHERRNO /* ISC does not set h_errno in gethostbyname */ +#define SUNW_OVERRIDE_RETRY /* Allow NS switch to override res->retry */ +#define SUNW_CLOSEFROM /* closefrom(3C) per PSARC 2000/193 */ +#define SUNW_AVOIDSTDIO_FDLIMIT /* Avoid 256 file descriptor limit in stdio */ +#define SUNW_LIBMD5 /* Use md5(3EXT) instead of internal implementation */ + +/* If compiling an MT warm libresolv, we also need reentrancy */ +#if defined(SUNW_MT_RESOLVER) && !defined(_REENTRANT) +#define _REENTRANT +#endif + +/* SUNW_AREWEINNAMED and SUNW_CONFCHECCK are mutually inclusive */ +#if defined(SUNW_AREWEINNAMED) && !defined(SUNW_CONFCHECK) +#define SUNW_CONFCHECK +#endif + +/* End additions for Solaris 2 */ + +#endif /* _SUNOPTIONS_H */ diff --git a/usr/src/lib/libresolv2/include/err.h b/usr/src/lib/libresolv2/include/err.h new file mode 100644 index 0000000000..45992ea336 --- /dev/null +++ b/usr/src/lib/libresolv2/include/err.h @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2001 by Sun Microsystems, Inc. + * All rights reserved. + */ + +/*- + * Copyright (c) 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)err.h 8.1 (Berkeley) 6/2/93 + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifndef _ERR_H_ +#define _ERR_H_ + +#include <sys/cdefs.h> +#include <stdarg.h> + +__BEGIN_DECLS +__dead void err __P((int, const char *, ...)) __attribute__((__volatile)); +__dead void verr __P((int, const char *, va_list)) + __attribute__((__volatile)); +__dead void errx __P((int, const char *, ...)) __attribute__((__volatile)); +__dead void verrx __P((int, const char *, va_list)) + __attribute__((__volatile)); +void warn __P((const char *, ...)); +void vwarn __P((const char *, va_list)); +void warnx __P((const char *, ...)); +void vwarnx __P((const char *, va_list)); +__END_DECLS + +#endif /* !_ERR_H_ */ diff --git a/usr/src/lib/libresolv2/include/fd_setsize.h b/usr/src/lib/libresolv2/include/fd_setsize.h new file mode 100644 index 0000000000..f6af1b2488 --- /dev/null +++ b/usr/src/lib/libresolv2/include/fd_setsize.h @@ -0,0 +1,18 @@ +/* + * Copyright (c) 1999 by Sun Microsystems, Inc. + * All rights reserved. + * + * No ISC copyright for this file. + */ + +#ifndef _FD_SETSIZE_H +#define _FD_SETSIZE_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * If you need a bigger FD_SETSIZE, this is NOT the place to set it. + * This file is a fallback for BIND ports which don't specify their own. + */ + +#endif /* _FD_SETSIZE_H */ diff --git a/usr/src/lib/libresolv2/include/hesiod.h b/usr/src/lib/libresolv2/include/hesiod.h new file mode 100644 index 0000000000..5f113734c8 --- /dev/null +++ b/usr/src/lib/libresolv2/include/hesiod.h @@ -0,0 +1,47 @@ +/* + * Copyright (c) 1997-2000 by Sun Microsystems, Inc. + * All rights reserved. + */ + +/* + * Copyright (c) 1996,1999 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * This file is primarily maintained by <tytso@mit.edu> and <ghudson@mit.edu>. + */ + +/* + * $Id: hesiod.h,v 1.7 1999/01/08 19:22:45 vixie Exp $ + */ + +#ifndef _HESIOD_H_INCLUDED +#define _HESIOD_H_INCLUDED + +int hesiod_init __P((void **context)); +void hesiod_end __P((void *context)); +char * hesiod_to_bind __P((void *context, const char *name, + const char *type)); +char ** hesiod_resolve __P((void *context, const char *name, + const char *type)); +void hesiod_free_list __P((void *context, char **list)); +struct __res_state * __hesiod_res_get __P((void *context)); +void __hesiod_res_set __P((void *context, struct __res_state *, + void (*)(void *))); + +#endif /*_HESIOD_H_INCLUDED*/ diff --git a/usr/src/lib/libresolv2/include/inet_private.h b/usr/src/lib/libresolv2/include/inet_private.h new file mode 100644 index 0000000000..c9c03ab478 --- /dev/null +++ b/usr/src/lib/libresolv2/include/inet_private.h @@ -0,0 +1,31 @@ +/* + * Copyright (c) 1999 by Sun Microsystems, Inc. + * All rights reserved. + */ + +#ifndef _INET_PRIVATE_H +#define _INET_PRIVATE_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * Functions defined by the ISC for BIND 8.2, but which do not appear + * in RFC 2553 (hence, aren't suitable for inclusion in <inet.h>). + */ + +#ifdef __STDC__ +#ifndef __P +#define __P(x) x +#endif +#else +#ifndef __P +#define __P(x) () +#endif +#endif /* __STDC__ */ + +char * inet_net_ntop __P((int, const void *, int, char *, size_t)); +int inet_net_pton __P((int, const char *, void *, size_t)); +u_int inet_nsap_addr __P((const char *, u_char *, int)); +char * inet_nsap_ntoa __P((int, const u_char *, char *)); + +#endif /* _INET_PRIVATE_H */ diff --git a/usr/src/lib/libresolv2/include/irp.h b/usr/src/lib/libresolv2/include/irp.h new file mode 100644 index 0000000000..76b7b23441 --- /dev/null +++ b/usr/src/lib/libresolv2/include/irp.h @@ -0,0 +1,112 @@ +/* + * Copyright 2003 by Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + * + */ + +/* + * Copyright (c) 1999 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +/* + * $Id: irp.h,v 8.4 2003/05/02 05:56:21 marka Exp $ + */ + +#ifndef _IRP_H_INCLUDED +#define _IRP_H_INCLUDED + +#pragma ident "%Z%%M% %I% %E% SMI" + +#define IRPD_TIMEOUT 30 /* seconds */ +#define IRPD_MAXSESS 50 /* number of simultaneous sessions. */ +#define IRPD_PORT 6660 /* 10 times the number of the beast. */ +#define IRPD_PATH "/var/run/irpd" /* af_unix socket path */ + +/* If sets the environment variable IRPDSERVER to an IP address + (e.g. "192.5.5.1"), then that's the host the client expects irpd to be + running on. */ +#define IRPD_HOST_ENV "IRPDSERVER" + +/* Protocol response codes. */ +#define IRPD_WELCOME_CODE 200 +#define IRPD_NOT_WELCOME_CODE 500 + +#define IRPD_GETHOST_ERROR 510 +#define IRPD_GETHOST_NONE 210 +#define IRPD_GETHOST_OK 211 +#define IRPD_GETHOST_SETOK 212 + +#define IRPD_GETNET_ERROR 520 +#define IRPD_GETNET_NONE 220 +#define IRPD_GETNET_OK 221 +#define IRPD_GETNET_SETOK 222 + +#define IRPD_GETUSER_ERROR 530 +#define IRPD_GETUSER_NONE 230 +#define IRPD_GETUSER_OK 231 +#define IRPD_GETUSER_SETOK 232 + +#define IRPD_GETGROUP_ERROR 540 +#define IRPD_GETGROUP_NONE 240 +#define IRPD_GETGROUP_OK 241 +#define IRPD_GETGROUP_SETOK 242 + +#define IRPD_GETSERVICE_ERROR 550 +#define IRPD_GETSERVICE_NONE 250 +#define IRPD_GETSERVICE_OK 251 +#define IRPD_GETSERVICE_SETOK 252 + +#define IRPD_GETPROTO_ERROR 560 +#define IRPD_GETPROTO_NONE 260 +#define IRPD_GETPROTO_OK 261 +#define IRPD_GETPROTO_SETOK 262 + +#define IRPD_GETNETGR_ERROR 570 +#define IRPD_GETNETGR_NONE 270 +#define IRPD_GETNETGR_OK 271 +#define IRPD_GETNETGR_NOMORE 272 +#define IRPD_GETNETGR_MATCHES 273 +#define IRPD_GETNETGR_NOMATCH 274 +#define IRPD_GETNETGR_SETOK 275 +#define IRPD_GETNETGR_SETERR 276 + +#define irs_irp_read_body __irs_irp_read_body +#define irs_irp_read_response __irs_irp_read_response +#define irs_irp_disconnect __irs_irp_disconnect +#define irs_irp_connect __irs_irp_connect +#define irs_irp_connection_setup __irs_irp_connection_setup +#define irs_irp_send_command __irs_irp_send_command + +struct irp_p; + +char *irs_irp_read_body(struct irp_p *pvt, size_t *size); +int irs_irp_read_response(struct irp_p *pvt, char *text, size_t len); +void irs_irp_disconnect(struct irp_p *pvt); +int irs_irp_connect(struct irp_p *pvt); +int irs_irp_is_connected(struct irp_p *pvt); +int irs_irp_connection_setup(struct irp_p *cxndata, int *warned); +#ifdef __GNUC__ +int irs_irp_send_command(struct irp_p *, const char *, ...) + __attribute__((__format__(__printf__, 2, 3))); +#else +int irs_irp_send_command(struct irp_p *pvt, const char *fmt, ...); +#endif +int irs_irp_get_full_response(struct irp_p *pvt, int *code, char *text, + size_t textlen, char **body, + size_t *bodylen); +int irs_irp_read_line(struct irp_p *pvt, char *buffer, int len); + +#endif diff --git a/usr/src/lib/libresolv2/include/irs.h b/usr/src/lib/libresolv2/include/irs.h new file mode 100644 index 0000000000..d676136ac9 --- /dev/null +++ b/usr/src/lib/libresolv2/include/irs.h @@ -0,0 +1,383 @@ +/* + * Copyright 2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * Copyright (c) 1996,1999 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * $Id: irs.h,v 8.9 2003/04/29 05:51:13 marka Exp $ + */ + +#ifndef _IRS_H_INCLUDED +#define _IRS_H_INCLUDED + +#include <sys/types.h> + +#include <arpa/nameser.h> + +#include <grp.h> +#include <netdb.h> +#include <resolv.h> +#include <pwd.h> + +/* + * This is the group map class. + */ +struct irs_gr { + void * private; + void (*close) __P((struct irs_gr *)); + struct group * (*next) __P((struct irs_gr *)); + struct group * (*byname) __P((struct irs_gr *, const char *)); + struct group * (*bygid) __P((struct irs_gr *, gid_t)); + int (*list) __P((struct irs_gr *, const char *, + gid_t, gid_t *, int *)); + void (*rewind) __P((struct irs_gr *)); + void (*minimize) __P((struct irs_gr *)); + struct __res_state * (*res_get) __P((struct irs_gr *)); + void (*res_set) __P((struct irs_gr *, res_state, + void (*)(void *))); +}; + +/* + * This is the password map class. + */ +struct irs_pw { + void * private; + void (*close) __P((struct irs_pw *)); + struct passwd * (*next) __P((struct irs_pw *)); + struct passwd * (*byname) __P((struct irs_pw *, const char *)); + struct passwd * (*byuid) __P((struct irs_pw *, uid_t)); + void (*rewind) __P((struct irs_pw *)); + void (*minimize) __P((struct irs_pw *)); + struct __res_state * (*res_get) __P((struct irs_pw *)); + void (*res_set) __P((struct irs_pw *, res_state, + void (*)(void *))); +}; + +/* + * This is the service map class. + */ +struct irs_sv { + void * private; + void (*close) __P((struct irs_sv *)); + struct servent *(*byname) __P((struct irs_sv *, + const char *, const char *)); + struct servent *(*byport) __P((struct irs_sv *, int, const char *)); + struct servent *(*next) __P((struct irs_sv *)); + void (*rewind) __P((struct irs_sv *)); + void (*minimize) __P((struct irs_sv *)); + struct __res_state * (*res_get) __P((struct irs_sv *)); + void (*res_set) __P((struct irs_sv *, res_state, + void (*)(void *))); +}; + +/* + * This is the protocols map class. + */ +struct irs_pr { + void * private; + void (*close) __P((struct irs_pr *)); + struct protoent *(*byname) __P((struct irs_pr *, const char *)); + struct protoent *(*bynumber) __P((struct irs_pr *, int)); + struct protoent *(*next) __P((struct irs_pr *)); + void (*rewind) __P((struct irs_pr *)); + void (*minimize) __P((struct irs_pr *)); + struct __res_state * (*res_get) __P((struct irs_pr *)); + void (*res_set) __P((struct irs_pr *, res_state, + void (*)(void *))); +}; + +/* + * This is the hosts map class. + */ +struct irs_ho { + void * private; + void (*close) __P((struct irs_ho *)); + struct hostent *(*byname) __P((struct irs_ho *, const char *)); + struct hostent *(*byname2) __P((struct irs_ho *, const char *, int)); + struct hostent *(*byaddr) __P((struct irs_ho *, + const void *, int, int)); + struct hostent *(*next) __P((struct irs_ho *)); + void (*rewind) __P((struct irs_ho *)); + void (*minimize) __P((struct irs_ho *)); + struct __res_state * (*res_get) __P((struct irs_ho *)); + void (*res_set) __P((struct irs_ho *, res_state, + void (*)(void *))); + struct addrinfo *(*addrinfo) __P((struct irs_ho *, const char *, + const struct addrinfo *)); +}; + +/* + * This is the networks map class. + */ +struct irs_nw { + void * private; + void (*close) __P((struct irs_nw *)); + struct nwent * (*byname) __P((struct irs_nw *, const char *, int)); + struct nwent * (*byaddr) __P((struct irs_nw *, void *, int, int)); + struct nwent * (*next) __P((struct irs_nw *)); + void (*rewind) __P((struct irs_nw *)); + void (*minimize) __P((struct irs_nw *)); + struct __res_state * (*res_get) __P((struct irs_nw *)); + void (*res_set) __P((struct irs_nw *, res_state, + void (*)(void *))); +}; + +/* + * This is the netgroups map class. + */ +struct irs_ng { + void * private; + void (*close) __P((struct irs_ng *)); + int (*next) __P((struct irs_ng *, const char **, + const char **, const char **)); + int (*test) __P((struct irs_ng *, const char *, + const char *, const char *, + const char *)); + void (*rewind) __P((struct irs_ng *, const char *)); + void (*minimize) __P((struct irs_ng *)); +}; + +/* + * This is the generic map class, which copies the front of all others. + */ +struct irs_map { + void * private; + void (*close) __P((void *)); +}; + +/* + * This is the accessor class. It contains pointers to all of the + * initializers for the map classes for a particular accessor. + */ +struct irs_acc { + void * private; + void (*close) __P((struct irs_acc *)); + struct irs_gr * (*gr_map) __P((struct irs_acc *)); + struct irs_pw * (*pw_map) __P((struct irs_acc *)); + struct irs_sv * (*sv_map) __P((struct irs_acc *)); + struct irs_pr * (*pr_map) __P((struct irs_acc *)); + struct irs_ho * (*ho_map) __P((struct irs_acc *)); + struct irs_nw * (*nw_map) __P((struct irs_acc *)); + struct irs_ng * (*ng_map) __P((struct irs_acc *)); + struct __res_state * (*res_get) __P((struct irs_acc *)); + void (*res_set) __P((struct irs_acc *, res_state, + void (*)(void *))); +}; + +/* + * This is because the official definition of "struct netent" has no + * concept of CIDR even though it allows variant address families (on + * output but not input). The compatibility stubs convert the structs + * below into "struct netent"'s. + */ +struct nwent { + char *n_name; /* official name of net */ + char **n_aliases; /* alias list */ + int n_addrtype; /* net address type */ + void *n_addr; /* network address */ + int n_length; /* address length, in bits */ +}; + +/* + * Hide external function names from POSIX. + */ +#define irs_gen_acc __irs_gen_acc +#define irs_lcl_acc __irs_lcl_acc +#define irs_dns_acc __irs_dns_acc +#define irs_nis_acc __irs_nis_acc +#define irs_irp_acc __irs_irp_acc +#ifdef ORIGINAL_ISC_CODE +#define irs_destroy __irs_destroy +#else +#endif +#define irs_dns_gr __irs_dns_gr +#define irs_dns_ho __irs_dns_ho +#define irs_dns_nw __irs_dns_nw +#define irs_dns_pr __irs_dns_pr +#define irs_dns_pw __irs_dns_pw +#define irs_dns_sv __irs_dns_sv +#define irs_gen_gr __irs_gen_gr +#define irs_gen_ho __irs_gen_ho +#define irs_gen_ng __irs_gen_ng +#define irs_gen_nw __irs_gen_nw +#define irs_gen_pr __irs_gen_pr +#define irs_gen_pw __irs_gen_pw +#define irs_gen_sv __irs_gen_sv +#define irs_irp_get_full_response __irs_irp_get_full_response +#define irs_irp_gr __irs_irp_gr +#define irs_irp_ho __irs_irp_ho +#define irs_irp_is_connected __irs_irp_is_connected +#define irs_irp_ng __irs_irp_ng +#define irs_irp_nw __irs_irp_nw +#define irs_irp_pr __irs_irp_pr +#define irs_irp_pw __irs_irp_pw +#define irs_irp_read_line __irs_irp_read_line +#define irs_irp_sv __irs_irp_sv +#define irs_lcl_gr __irs_lcl_gr +#define irs_lcl_ho __irs_lcl_ho +#define irs_lcl_ng __irs_lcl_ng +#define irs_lcl_nw __irs_lcl_nw +#define irs_lcl_pr __irs_lcl_pr +#define irs_lcl_pw __irs_lcl_pw +#define irs_lcl_sv __irs_lcl_sv +#define irs_nis_gr __irs_nis_gr +#define irs_nis_ho __irs_nis_ho +#define irs_nis_ng __irs_nis_ng +#define irs_nis_nw __irs_nis_nw +#define irs_nis_pr __irs_nis_pr +#define irs_nis_pw __irs_nis_pw +#define irs_nis_sv __irs_nis_sv +#define net_data_create __net_data_create +#define net_data_destroy __net_data_destroy +#ifdef ORIGINAL_ISC_CODE +#define net_data_minimize __net_data_minimize +#else +#endif + +/* + * Externs. + */ +extern struct irs_acc * irs_gen_acc __P((const char *options, + const char *conf_file)); +extern struct irs_acc * irs_lcl_acc __P((const char *options)); +extern struct irs_acc * irs_dns_acc __P((const char *options)); +extern struct irs_acc * irs_nis_acc __P((const char *options)); +extern struct irs_acc * irs_irp_acc __P((const char *options)); + +extern void irs_destroy(void); + +/* + * These forward declarations are for the semi-private functions in + * the get*.c files. Each of these funcs implements the real get* + * functionality and the standard versions are just wrappers that + * call these. Apart from the wrappers, only irpd is expected to + * call these directly, hence these decls are put here and not in + * the /usr/include replacements. + */ + +struct net_data; /* forward */ + +/* + * net_data_create gets a singleton net_data object. net_data_init + * creates as many net_data objects as times it is called. Clients using + * the default interface will use net_data_create by default. Servers will + * probably want net_data_init (one call per client) + */ +struct net_data *net_data_create(const char *conf_file); +struct net_data *net_data_init(const char *conf_file); +void net_data_destroy(void *p); + +extern struct group *getgrent_p __P((struct net_data *net_data)); +extern struct group *getgrnam_p __P((const char *name, + struct net_data *net_data)); +extern struct group *getgrgid_p __P((gid_t gid, + struct net_data *net_data)); +extern int setgroupent_p __P((int stayopen, + struct net_data *net_data)); +extern void endgrent_p __P((struct net_data *net_data)); +extern int getgrouplist_p __P((const char *name, + gid_t basegid, + gid_t *groups, + int *ngroups, + struct net_data *net_data)); + +#ifdef SETGRENT_VOID +extern void setgrent_p __P((struct net_data *net_data)); +#else +extern int setgrent_p __P((struct net_data *net_data)); +#endif + +extern struct hostent *gethostbyname_p __P((const char *name, + struct net_data *net_data)); +extern struct hostent *gethostbyname2_p __P((const char *name, int af, + struct net_data *net_data)); +extern struct hostent *gethostbyaddr_p __P((const char *addr, int len, + int af, + struct net_data *net_data)); +extern struct hostent *gethostent_p __P((struct net_data *net_data)); +extern void sethostent_p __P((int stayopen, + struct net_data *net_data)); +extern void endhostent_p __P((struct net_data *net_data)); +extern struct hostent *getipnodebyname_p __P((const char *name, int af, + int flags, int *errp, + struct net_data *net_data)); +extern struct hostent *getipnodebyaddr_p __P((const void *addr, size_t len, + int af, int *errp, + struct net_data *net_data)); + +extern struct netent *getnetent_p __P((struct net_data *net_data)); +extern struct netent *getnetbyname_p __P((const char *name, + struct net_data *net_data)); +extern struct netent *getnetbyaddr_p __P((unsigned long net, int type, + struct net_data *net_data)); +extern void setnetent_p __P((int stayopen, + struct net_data *net_data)); +extern void endnetent_p __P((struct net_data *net_data)); + +extern void setnetgrent_p __P((const char *netgroup, + struct net_data *net_data)); +extern void endnetgrent_p __P((struct net_data *net_data)); +extern int innetgr_p __P((const char *netgroup, + const char *host, + const char *user, + const char *domain, + struct net_data *net_data)); +extern int getnetgrent_p __P((const char **host, const char **user, + const char **domain, + struct net_data *net_data)); + +extern struct protoent *getprotoent_p __P((struct net_data *net_data)); +extern struct protoent *getprotobyname_p __P((const char *name, + struct net_data *net_data)); +extern struct protoent *getprotobynumber_p __P((int proto, + struct net_data *net_data)); +extern void setprotoent_p __P((int stayopen, + struct net_data *net_data)); +extern void endprotoent_p __P((struct net_data *net_data)); + + +extern struct passwd *getpwent_p __P((struct net_data *net_data)); +extern struct passwd *getpwnam_p __P((const char *name, + struct net_data *net_data)); +extern struct passwd *getpwuid_p __P((uid_t uid, + struct net_data *net_data)); +extern int setpassent_p __P((int stayopen, + struct net_data *net_data)); +extern void endpwent_p __P((struct net_data *net_data)); + +#ifdef SETPWENT_VOID +extern void setpwent_p __P((struct net_data *net_data)); +#else +extern int setpwent_p __P((struct net_data *net_data)); +#endif + +extern struct servent *getservent_p __P((struct net_data *net_data)); +extern struct servent *getservbyname_p __P((const char *name, + const char *proto, + struct net_data *net_data)); +extern struct servent *getservbyport_p __P((int port, const char *proto, + struct net_data *net_data)); +extern void setservent_p __P((int stayopen, + struct net_data *net_data)); +extern void endservent_p __P((struct net_data *net_data)); + +#endif /*_IRS_H_INCLUDED*/ diff --git a/usr/src/lib/libresolv2/include/isc/assertions.h b/usr/src/lib/libresolv2/include/isc/assertions.h new file mode 100644 index 0000000000..1f02d666ce --- /dev/null +++ b/usr/src/lib/libresolv2/include/isc/assertions.h @@ -0,0 +1,129 @@ +/* + * Copyright 1997-2002 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * Copyright (c) 1997-1999 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * $Id: assertions.h,v 8.4 2001/05/29 05:47:07 marka Exp $ + */ + +#ifndef ASSERTIONS_H +#define ASSERTIONS_H 1 + +typedef enum { + assert_require, assert_ensure, assert_insist, assert_invariant +} assertion_type; + +typedef void (*assertion_failure_callback)(const char *, int, assertion_type, + const char *, int); + +extern assertion_failure_callback __assertion_failed; +void set_assertion_failure_callback(assertion_failure_callback f); +const char *assertion_type_to_text(assertion_type type); + +#ifdef CHECK_ALL +#define CHECK_REQUIRE 1 +#define CHECK_ENSURE 1 +#define CHECK_INSIST 1 +#define CHECK_INVARIANT 1 +#endif + +#ifdef CHECK_NONE +#define CHECK_REQUIRE 0 +#define CHECK_ENSURE 0 +#define CHECK_INSIST 0 +#define CHECK_INVARIANT 0 +#endif + +#ifndef CHECK_REQUIRE +#define CHECK_REQUIRE 1 +#endif + +#ifndef CHECK_ENSURE +#define CHECK_ENSURE 1 +#endif + +#ifndef CHECK_INSIST +#define CHECK_INSIST 1 +#endif + +#ifndef CHECK_INVARIANT +#define CHECK_INVARIANT 1 +#endif + +#if CHECK_REQUIRE != 0 +#define REQUIRE(cond) \ + ((void) ((cond) || \ + ((__assertion_failed)(__FILE__, __LINE__, assert_require, \ + #cond, 0), 0))) +#define REQUIRE_ERR(cond) \ + ((void) ((cond) || \ + ((__assertion_failed)(__FILE__, __LINE__, assert_require, \ + #cond, 1), 0))) +#else +#define REQUIRE(cond) ((void) (cond)) +#define REQUIRE_ERR(cond) ((void) (cond)) +#endif /* CHECK_REQUIRE */ + +#if CHECK_ENSURE != 0 +#define ENSURE(cond) \ + ((void) ((cond) || \ + ((__assertion_failed)(__FILE__, __LINE__, assert_ensure, \ + #cond, 0), 0))) +#define ENSURE_ERR(cond) \ + ((void) ((cond) || \ + ((__assertion_failed)(__FILE__, __LINE__, assert_ensure, \ + #cond, 1), 0))) +#else +#define ENSURE(cond) ((void) (cond)) +#define ENSURE_ERR(cond) ((void) (cond)) +#endif /* CHECK_ENSURE */ + +#if CHECK_INSIST != 0 +#define INSIST(cond) \ + ((void) ((cond) || \ + ((__assertion_failed)(__FILE__, __LINE__, assert_insist, \ + #cond, 0), 0))) +#define INSIST_ERR(cond) \ + ((void) ((cond) || \ + ((__assertion_failed)(__FILE__, __LINE__, assert_insist, \ + #cond, 1), 0))) +#else +#define INSIST(cond) ((void) (cond)) +#define INSIST_ERR(cond) ((void) (cond)) +#endif /* CHECK_INSIST */ + +#if CHECK_INVARIANT != 0 +#define INVARIANT(cond) \ + ((void) ((cond) || \ + ((__assertion_failed)(__FILE__, __LINE__, assert_invariant, \ + #cond, 0), 0))) +#define INVARIANT_ERR(cond) \ + ((void) ((cond) || \ + ((__assertion_failed)(__FILE__, __LINE__, assert_invariant, \ + #cond, 1), 0))) +#else +#define INVARIANT(cond) ((void) (cond)) +#define INVARIANT_ERR(cond) ((void) (cond)) +#endif /* CHECK_INVARIANT */ + +#endif /* ASSERTIONS_H */ diff --git a/usr/src/lib/libresolv2/include/isc/ctl.h b/usr/src/lib/libresolv2/include/isc/ctl.h new file mode 100644 index 0000000000..6b178c446a --- /dev/null +++ b/usr/src/lib/libresolv2/include/isc/ctl.h @@ -0,0 +1,116 @@ +/* + * Copyright 2000-2002 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef ISC_CTL_H +#define ISC_CTL_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * Copyright (c) 1998,1999 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +/* + * $Id: ctl.h,v 8.11 2001/08/10 02:40:49 marka Exp $ + */ + +#include <sys/types.h> +#include <sys/socket.h> + +#include <isc/eventlib.h> + +/* Macros. */ + +#define CTL_MORE 0x0001 /* More will be / should be sent. */ +#define CTL_EXIT 0x0002 /* Close connection after this. */ +#define CTL_DATA 0x0004 /* Go into / this is DATA mode. */ + +/* Types. */ + +struct ctl_cctx; +struct ctl_sctx; +struct ctl_sess; +struct ctl_verb; + +enum ctl_severity { ctl_debug, ctl_warning, ctl_error }; + +typedef void (*ctl_logfunc)(enum ctl_severity, const char *fmt, ...); + +typedef void (*ctl_verbfunc)(struct ctl_sctx *, struct ctl_sess *, + const struct ctl_verb *, const char *rest, + u_int respflags, const void *respctx, void *uctx); + +typedef void (*ctl_srvrdone)(struct ctl_sctx *, struct ctl_sess *, void *); + +typedef void (*ctl_clntdone)(struct ctl_cctx *, void *, const char *, u_int); + +struct ctl_verb { + const char * name; + ctl_verbfunc func; + const char * help; +}; + +/* General symbols. */ + +#define ctl_logger __ctl_logger + +#ifdef __GNUC__ +void ctl_logger(enum ctl_severity, const char *, ...) + __attribute__((__format__(__printf__, 2, 3))); +#else +void ctl_logger(enum ctl_severity, const char *, ...); +#endif + +/* Client symbols. */ + +#define ctl_client __ctl_client +#define ctl_endclient __ctl_endclient +#define ctl_command __ctl_command + +struct ctl_cctx * ctl_client(evContext, const struct sockaddr *, size_t, + const struct sockaddr *, size_t, + ctl_clntdone, void *, + u_int, ctl_logfunc); +void ctl_endclient(struct ctl_cctx *); +int ctl_command(struct ctl_cctx *, const char *, size_t, + ctl_clntdone, void *); + +/* Server symbols. */ + +#define ctl_server __ctl_server +#define ctl_endserver __ctl_endserver +#define ctl_response __ctl_response +#define ctl_sendhelp __ctl_sendhelp +#define ctl_getcsctx __ctl_getcsctx +#define ctl_setcsctx __ctl_setcsctx + +struct ctl_sctx * ctl_server(evContext, const struct sockaddr *, size_t, + const struct ctl_verb *, + u_int, u_int, + u_int, int, int, + ctl_logfunc, void *); +void ctl_endserver(struct ctl_sctx *); +void ctl_response(struct ctl_sess *, u_int, + const char *, u_int, const void *, + ctl_srvrdone, void *, + const char *, size_t); +void ctl_sendhelp(struct ctl_sess *, u_int); +void * ctl_getcsctx(struct ctl_sess *); +void * ctl_setcsctx(struct ctl_sess *, void *); + +#endif /*ISC_CTL_H*/ diff --git a/usr/src/lib/libresolv2/include/isc/dst.h b/usr/src/lib/libresolv2/include/isc/dst.h new file mode 100644 index 0000000000..4460cf63ae --- /dev/null +++ b/usr/src/lib/libresolv2/include/isc/dst.h @@ -0,0 +1,193 @@ +/* + * Copyright 2003 by Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef DST_H +#define DST_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifndef HAS_DST_KEY +typedef struct dst_key { + char *dk_key_name; /* name of the key */ + int dk_key_size; /* this is the size of the key in bits */ + int dk_proto; /* what protocols this key can be used for */ + int dk_alg; /* algorithm number from key record */ + u_int32_t dk_flags; /* and the flags of the public key */ + u_int16_t dk_id; /* identifier of the key */ +} DST_KEY; +#endif /* HAS_DST_KEY */ + +#ifdef ORIGINAL_ISC_CODE +/* + * do not taint namespace + */ +#define dst_bsafe_init __dst_bsafe_init +#define dst_buffer_to_key __dst_buffer_to_key +#define dst_check_algorithm __dst_check_algorithm +#define dst_compare_keys __dst_compare_keys +#define dst_cylink_init __dst_cylink_init +#define dst_dnskey_to_key __dst_dnskey_to_key +#define dst_eay_dss_init __dst_eay_dss_init +#define dst_free_key __dst_free_key +#define dst_generate_key __dst_generate_key +#define dst_hmac_md5_init __dst_hmac_md5_init +#define dst_init __dst_init +#define dst_key_to_buffer __dst_key_to_buffer +#define dst_key_to_dnskey __dst_key_to_dnskey +#define dst_random __dst_random +#define dst_read_key __dst_read_key +#define dst_rsaref_init __dst_rsaref_init +#define dst_s_build_filename __dst_s_build_filename +#define dst_s_calculate_bits __dst_s_calculate_bits +#define dst_s_conv_bignum_b64_to_u8 __dst_s_conv_bignum_b64_to_u8 +#define dst_s_conv_bignum_u8_to_b64 __dst_s_conv_bignum_u8_to_b64 +#define dst_s_dns_key_id __dst_s_dns_key_id +#define dst_s_dump __dst_s_dump +#define dst_s_filename_length __dst_s_filename_length +#define dst_s_fopen __dst_s_fopen +#define dst_s_get_int16 __dst_s_get_int16 +#define dst_s_get_int32 __dst_s_get_int32 +#define dst_s_id_calc __dst_s_id_calc +#define dst_s_put_int16 __dst_s_put_int16 +#define dst_s_put_int32 __dst_s_put_int32 +#define dst_s_quick_random __dst_s_quick_random +#define dst_s_quick_random_set __dst_s_quick_random_set +#define dst_s_random __dst_s_random +#define dst_s_semi_random __dst_s_semi_random +#define dst_s_verify_str __dst_s_verify_str +#define dst_sig_size __dst_sig_size +#define dst_sign_data __dst_sign_data +#define dst_verify_data __dst_verify_data +#define dst_write_key __dst_write_key +#else +#endif + +/* + * DST Crypto API defintions + */ +void dst_init(void); +int dst_check_algorithm(const int); + +int dst_sign_data(const int mode, /* specifies INIT/UPDATE/FINAL/ALL */ + DST_KEY *in_key, /* the key to use */ + void **context, /* pointer to state structure */ + const u_char *data, /* data to be signed */ + const int len, /* length of input data */ + u_char *signature, /* buffer to write signature to */ + const int sig_len); /* size of output buffer */ + +int dst_verify_data(const int mode, /* specifies INIT/UPDATE/FINAL/ALL */ + DST_KEY *in_key, /* the key to use */ + void **context, /* pointer to state structure */ + const u_char *data, /* data to be verified */ + const int len, /* length of input data */ + const u_char *signature,/* buffer containing signature */ + const int sig_len); /* length of signature */ + + +DST_KEY *dst_read_key(const char *in_name, /* name of key */ + const u_int16_t in_id, /* key tag identifier */ + const int in_alg, /* key algorithm */ + const int key_type); /* Private/PublicKey wanted*/ + +int dst_write_key(const DST_KEY *key, /* key to write out */ + const int key_type); /* Public/Private */ + +DST_KEY *dst_dnskey_to_key(const char *in_name, /* KEY record name */ + const u_char *key, /* KEY RDATA */ + const int len); /* size of input buffer*/ + + +int dst_key_to_dnskey(const DST_KEY *key, /* key to translate */ + u_char *out_storage, /* output buffer */ + const int out_len); /* size of out_storage*/ + + +DST_KEY *dst_buffer_to_key(const char *key_name, /* name of the key */ + const int alg, /* algorithm */ + const int flags, /* dns flags */ + const int protocol, /* dns protocol */ + const u_char *key_buf, /* key in dns wire fmt */ + const int key_len); /* size of key */ + + +int dst_key_to_buffer(DST_KEY *key, u_char *out_buff, int buf_len); + +DST_KEY *dst_generate_key(const char *name, /* name of new key */ + const int alg, /* key algorithm to generate */ + const int bits, /* size of new key */ + const int exp, /* alg dependent parameter*/ + const int flags, /* key DNS flags */ + const int protocol); /* key DNS protocol */ + +DST_KEY *dst_free_key(DST_KEY *f_key); +int dst_compare_keys(const DST_KEY *key1, const DST_KEY *key2); + +int dst_sig_size(DST_KEY *key); + +int dst_random(const int mode, int wanted, u_char *outran); + + +/* support for dns key tags/ids */ +u_int16_t dst_s_dns_key_id(const u_char *dns_key_rdata, const int rdata_len); +u_int16_t dst_s_id_calc(const u_char *key_data, const int key_len); + +/* Used by callers as well as by the library. */ +#define RAW_KEY_SIZE 8192 /* large enough to store any key */ + +/* DST_API control flags */ +/* These are used used in functions dst_sign_data and dst_verify_data */ +#define SIG_MODE_INIT 1 /* initialize digest */ +#define SIG_MODE_UPDATE 2 /* add data to digest */ +#define SIG_MODE_FINAL 4 /* generate/verify signature */ +#define SIG_MODE_ALL (SIG_MODE_INIT|SIG_MODE_UPDATE|SIG_MODE_FINAL) + +/* Flags for dst_read_private_key() */ +#define DST_FORCE_READ 0x1000000 +#define DST_CAN_SIGN 0x010F +#define DST_NO_AUTHEN 0x8000 +#define DST_EXTEND_FLAG 0x1000 +#define DST_STANDARD 0 +#define DST_PRIVATE 0x2000000 +#define DST_PUBLIC 0x4000000 +#define DST_RAND_SEMI 1 +#define DST_RAND_STD 2 +#define DST_RAND_KEY 3 +#define DST_RAND_DSS 4 + + +/* DST algorithm codes */ +#define KEY_RSA 1 +#define KEY_DH 2 +#define KEY_DSA 3 +#define KEY_PRIVATE 254 +#define KEY_EXPAND 255 +#define KEY_HMAC_MD5 157 +#define KEY_HMAC_SHA1 158 +#define UNKNOWN_KEYALG 0 +#define DST_MAX_ALGS KEY_HMAC_SHA1 + +/* DST constants to locations in KEY record changes in new KEY record */ +#define DST_FLAGS_SIZE 2 +#define DST_KEY_PROT 2 +#define DST_KEY_ALG 3 +#define DST_EXT_FLAG 4 +#define DST_KEY_START 4 + +#ifndef SIGN_F_NOKEY +#define SIGN_F_NOKEY 0xC000 +#endif + +/* error codes from dst routines */ +#define SIGN_INIT_FAILURE (-23) +#define SIGN_UPDATE_FAILURE (-24) +#define SIGN_FINAL_FAILURE (-25) +#define VERIFY_INIT_FAILURE (-26) +#define VERIFY_UPDATE_FAILURE (-27) +#define VERIFY_FINAL_FAILURE (-28) +#define MISSING_KEY_OR_SIGNATURE (-30) +#define UNSUPPORTED_KEYALG (-31) + +#endif /* DST_H */ diff --git a/usr/src/lib/libresolv2/include/isc/eventlib.h b/usr/src/lib/libresolv2/include/isc/eventlib.h new file mode 100644 index 0000000000..92988f63ca --- /dev/null +++ b/usr/src/lib/libresolv2/include/isc/eventlib.h @@ -0,0 +1,209 @@ +/* + * Copyright 1997-2002 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * Copyright (c) 1995-1999 by Internet Software Consortium + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +/* eventlib.h - exported interfaces for eventlib + * vix 09sep95 [initial] + * + * $Id: eventlib.h,v 1.23 2001/05/29 05:47:09 marka Exp $ + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifndef _EVENTLIB_H +#define _EVENTLIB_H + +#include <sys/types.h> +#include <sys/uio.h> +#include <sys/time.h> +#include <stdio.h> + +#ifndef __P +# define __EVENTLIB_P_DEFINED +# ifdef __STDC__ +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + +/* In the absence of branded types... */ +typedef struct { void *opaque; } evConnID; +typedef struct { void *opaque; } evFileID; +typedef struct { void *opaque; } evStreamID; +typedef struct { void *opaque; } evTimerID; +typedef struct { void *opaque; } evWaitID; +typedef struct { void *opaque; } evContext; +typedef struct { void *opaque; } evEvent; + +#define evInitID(id) ((id)->opaque = NULL) +#define evTestID(id) ((id).opaque != NULL) + +typedef void (*evConnFunc)__P((evContext ctx, void *uap, int fd, + const void *la, int lalen, + const void *ra, int ralen)); +typedef void (*evFileFunc)__P((evContext ctx, void *uap, int fd, int evmask)); +typedef void (*evStreamFunc)__P((evContext ctx, void *uap, int fd, int bytes)); +typedef void (*evTimerFunc)__P((evContext ctx, void *uap, + struct timespec due, struct timespec inter)); +typedef void (*evWaitFunc)__P((evContext ctx, void *uap, const void *tag)); + +typedef struct { unsigned char mask[256/8]; } evByteMask; +#define EV_BYTEMASK_BYTE(b) ((b) / 8) +#define EV_BYTEMASK_MASK(b) (1 << ((b) % 8)) +#define EV_BYTEMASK_SET(bm, b) \ + ((bm).mask[EV_BYTEMASK_BYTE(b)] |= EV_BYTEMASK_MASK(b)) +#define EV_BYTEMASK_CLR(bm, b) \ + ((bm).mask[EV_BYTEMASK_BYTE(b)] &= ~EV_BYTEMASK_MASK(b)) +#define EV_BYTEMASK_TST(bm, b) \ + ((bm).mask[EV_BYTEMASK_BYTE(b)] & EV_BYTEMASK_MASK(b)) + +#define EV_POLL 1 +#define EV_WAIT 2 +#define EV_NULL 4 + +#define EV_READ 1 +#define EV_WRITE 2 +#define EV_EXCEPT 4 + +/* eventlib.c */ +#define evCreate __evCreate +#define evSetDebug __evSetDebug +#define evDestroy __evDestroy +#define evGetNext __evGetNext +#define evDispatch __evDispatch +#define evDrop __evDrop +#define evMainLoop __evMainLoop +#define evHighestFD __evHighestFD + +int evCreate __P((evContext *ctx)); +void evSetDebug __P((evContext ctx, int lev, FILE *out)); +int evDestroy __P((evContext ctx)); +int evGetNext __P((evContext ctx, evEvent *ev, int options)); +int evDispatch __P((evContext ctx, evEvent ev)); +void evDrop __P((evContext ctx, evEvent ev)); +int evMainLoop __P((evContext ctx)); +int evHighestFD __P((evContext ctx)); + +#ifdef SUNW_POLL +extern void evPollfdAdd(evContext ctx, int pollfd_chunk_size, int fd, + short events); +extern void evPollfdDel(evContext ctx, int fd); +#endif /* SUNW_POLL */ + +/* ev_connects.c */ +#define evListen __evListen +#define evConnect __evConnect +#define evCancelConn __evCancelConn +#define evHold __evHold +#define evUnhold __evUnhold +#define evTryAccept __evTryAccept + +int evListen __P((evContext ctx, int fd, int maxconn, + evConnFunc func, void *uap, evConnID *id)); +int evConnect __P((evContext ctx, int fd, const void *ra, int ralen, + evConnFunc func, void *uap, evConnID *id)); +int evCancelConn __P((evContext ctx, evConnID id)); +int evHold __P((evContext, evConnID)); +int evUnhold __P((evContext, evConnID)); +int evTryAccept __P((evContext, evConnID, int *)); + +/* ev_files.c */ +#define evSelectFD __evSelectFD +#define evDeselectFD __evDeselectFD + +int evSelectFD __P((evContext ctx, int fd, int eventmask, + evFileFunc func, void *uap, evFileID *id)); +int evDeselectFD __P((evContext ctx, evFileID id)); + +/* ev_streams.c */ +#define evConsIovec __evConsIovec +#define evWrite __evWrite +#define evRead __evRead +#define evTimeRW __evTimeRW +#define evUntimeRW __evUntimeRW +#define evCancelRW __evCancelRW + +struct iovec evConsIovec __P((void *buf, size_t cnt)); +int evWrite __P((evContext ctx, int fd, const struct iovec *iov, int cnt, + evStreamFunc func, void *uap, evStreamID *id)); +int evRead __P((evContext ctx, int fd, const struct iovec *iov, int cnt, + evStreamFunc func, void *uap, evStreamID *id)); +int evTimeRW __P((evContext ctx, evStreamID id, evTimerID timer)); +int evUntimeRW __P((evContext ctx, evStreamID id)); +int evCancelRW __P((evContext ctx, evStreamID id)); + +/* ev_timers.c */ +#define evConsTime __evConsTime +#define evAddTime __evAddTime +#define evSubTime __evSubTime +#define evCmpTime __evCmpTime +#define evTimeSpec __evTimeSpec +#define evTimeVal __evTimeVal + +#define evNowTime __evNowTime +#define evLastEventTime __evLastEventTime +#define evSetTimer __evSetTimer +#define evClearTimer __evClearTimer +#define evResetTimer __evResetTimer +#define evSetIdleTimer __evSetIdleTimer +#define evClearIdleTimer __evClearIdleTimer +#define evResetIdleTimer __evResetIdleTimer +#define evTouchIdleTimer __evTouchIdleTimer + +struct timespec evConsTime __P((time_t sec, long nsec)); +struct timespec evAddTime __P((struct timespec add1, struct timespec add2)); +struct timespec evSubTime __P((struct timespec minu, struct timespec subtra)); +struct timespec evNowTime __P((void)); +struct timespec evLastEventTime __P((evContext)); +struct timespec evTimeSpec __P((struct timeval)); +struct timeval evTimeVal __P((struct timespec)); +int evCmpTime __P((struct timespec a, struct timespec b)); +int evSetTimer __P((evContext ctx, evTimerFunc func, void *uap, + struct timespec due, struct timespec inter, + evTimerID *id)); +int evClearTimer __P((evContext ctx, evTimerID id)); +int evResetTimer __P((evContext, evTimerID, evTimerFunc, void *, + struct timespec, struct timespec)); +int evSetIdleTimer __P((evContext, evTimerFunc, void *, struct timespec, + evTimerID *)); +int evClearIdleTimer __P((evContext, evTimerID)); +int evResetIdleTimer __P((evContext, evTimerID, evTimerFunc, void *, + struct timespec)); +int evTouchIdleTimer __P((evContext, evTimerID)); + +/* ev_waits.c */ +#define evWaitFor __evWaitFor +#define evDo __evDo +#define evUnwait __evUnwait +#define evDefer __evDefer + +int evWaitFor __P((evContext ctx, const void *tag, evWaitFunc func, void *uap, + evWaitID *id)); +int evDo __P((evContext ctx, const void *tag)); +int evUnwait __P((evContext ctx, evWaitID id)); +int evDefer __P((evContext, evWaitFunc, void *)); + +#ifdef __EVENTLIB_P_DEFINED +# undef __P +#endif + +#endif /*_EVENTLIB_H*/ diff --git a/usr/src/lib/libresolv2/include/isc/heap.h b/usr/src/lib/libresolv2/include/isc/heap.h new file mode 100644 index 0000000000..46093f506d --- /dev/null +++ b/usr/src/lib/libresolv2/include/isc/heap.h @@ -0,0 +1,54 @@ + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +/* + * Copyright (c) 1997 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ +#pragma ident "%Z%%M% %I% %E% SMI" + +typedef int (*heap_higher_priority_func)(void *, void *); +typedef void (*heap_index_func)(void *, int); +typedef void (*heap_for_each_func)(void *, void *); + +typedef struct heap_context { + int array_size; + int array_size_increment; + int heap_size; + void **heap; + heap_higher_priority_func higher_priority; + heap_index_func index; +} *heap_context; + +#define heap_new __heap_new +#define heap_free __heap_free +#define heap_insert __heap_insert +#define heap_delete __heap_delete +#define heap_increased __heap_increased +#define heap_decreased __heap_decreased +#define heap_element __heap_element +#define heap_for_each __heap_for_each + +heap_context heap_new(heap_higher_priority_func, heap_index_func, int); +int heap_free(heap_context); +int heap_insert(heap_context, void *); +int heap_delete(heap_context, int); +int heap_increased(heap_context, int); +int heap_decreased(heap_context, int); +void * heap_element(heap_context, int); +int heap_for_each(heap_context, heap_for_each_func, void *); diff --git a/usr/src/lib/libresolv2/include/isc/irpmarshall.h b/usr/src/lib/libresolv2/include/isc/irpmarshall.h new file mode 100644 index 0000000000..9ef0f2e4e4 --- /dev/null +++ b/usr/src/lib/libresolv2/include/isc/irpmarshall.h @@ -0,0 +1,123 @@ +/* + * Copyright 2000-2002 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * Copyright (c) 1999 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +/* + * $Id: irpmarshall.h,v 8.2 2001/05/29 05:47:10 marka Exp $ + */ + +#ifndef _IRPMARSHALL_H_INCLUDED +#define _IRPMARSHALL_H_INCLUDED + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* Hide function names */ +#define irp_marshall_gr __irp_marshall_gr +#define irp_marshall_ho __irp_marshall_ho +#define irp_marshall_ne __irp_marshall_ne +#define irp_marshall_ng __irp_marshall_ng +#define irp_marshall_nw __irp_marshall_nw +#define irp_marshall_pr __irp_marshall_pr +#define irp_marshall_pw __irp_marshall_pw +#define irp_marshall_sv __irp_marshall_sv +#define irp_unmarshall_gr __irp_unmarshall_gr +#define irp_unmarshall_ho __irp_unmarshall_ho +#define irp_unmarshall_ne __irp_unmarshall_ne +#define irp_unmarshall_ng __irp_unmarshall_ng +#define irp_unmarshall_nw __irp_unmarshall_nw +#define irp_unmarshall_pr __irp_unmarshall_pr +#define irp_unmarshall_pw __irp_unmarshall_pw +#define irp_unmarshall_sv __irp_unmarshall_sv + +#define MAXPADDRSIZE (sizeof "255.255.255.255" + 1) +#define ADDR_T_STR(x) (x == AF_INET ? "AF_INET" :\ + (x == AF_INET6 ? "AF_INET6" : "UNKNOWN")) + +/* See comment below on usage */ +int irp_marshall_pw(const struct passwd *pw, char **buffer, size_t *len); +int irp_unmarshall_pw(struct passwd *pw, char *buffer); +int irp_marshall_gr(const struct group *gr, char **buffer, size_t *len); +int irp_unmarshall_gr(struct group *gr, char *buffer); +int irp_marshall_sv(const struct servent *sv, char **buffer, size_t *len); +int irp_unmarshall_sv(struct servent *sv, char *buffer); +int irp_marshall_pr(struct protoent *pr, char **buffer, size_t *len); +int irp_unmarshall_pr(struct protoent *pr, char *buffer); +int irp_marshall_ho(struct hostent *ho, char **buffer, size_t *len); +int irp_unmarshall_ho(struct hostent *ho, char *buffer); +int irp_marshall_ng(const char *host, const char *user, const char *domain, + char **buffer, size_t *len); +int irp_unmarshall_ng(const char **host, const char **user, + const char **domain, char *buffer); +int irp_marshall_nw(struct nwent *ne, char **buffer, size_t *len); +int irp_unmarshall_nw(struct nwent *ne, char *buffer); +int irp_marshall_ne(struct netent *ne, char **buffer, size_t *len); +int irp_unmarshall_ne(struct netent *ne, char *buffer); + +/* + * Functions to marshall and unmarshall various system data structures. We + * use a printable ascii format that is as close to various system config + * files as reasonable (e.g. /etc/passwd format). + * + * We are not forgiving with unmarhsalling misformatted buffers. In + * particular whitespace in fields is not ignored. So a formatted password + * entry "brister :1364:100:...." will yield a username of "brister " + * + * We potentially do a lot of mallocs to fill fields that are of type + * (char **) like a hostent h_addr field. Building (for example) the + * h_addr field and its associated addresses all in one buffer is + * certainly possible, but not done here. + * + * The following description is true for all the marshalling functions: + * + */ + +/* int irp_marshall_XX(struct yyyy *XX, char **buffer, size_t *len); + * + * The argument XX (of type struct passwd for example) is marshalled in the + * buffer pointed at by *BUFFER, which is of length *LEN. Returns 0 + * on success and -1 on failure. Failure will occur if *LEN is + * smaller than needed. + * + * If BUFFER is NULL, then *LEN is set to the size of the buffer + * needed to marshall the data and no marshalling is actually done. + * + * If *BUFFER is NULL, then a buffer large enough will be allocated + * with memget() and the size allocated will be stored in *LEN. An extra 2 + * bytes will be allocated for the client to append CRLF if wanted. The + * value of *LEN will include these two bytes. + * + * All the marshalling functions produce a buffer with the fields + * separated by colons (except for the hostent marshalling, which uses '@' + * to separate fields). Fields that have multiple subfields (like the + * gr_mem field in struct group) have their subparts separated by + * commas. + */ + +/* + * int irp_unmarshall_XX(struct YYYYY *XX, char *buffer); + * + * The unmashalling functions break apart the buffer and store the + * values in the struct pointed to by XX. All pointer values inside + * XX are allocated with malloc. All arrays of pointers have a NULL + * as the last element. + */ + +#endif diff --git a/usr/src/lib/libresolv2/include/isc/list.h b/usr/src/lib/libresolv2/include/isc/list.h new file mode 100644 index 0000000000..dba0aad62d --- /dev/null +++ b/usr/src/lib/libresolv2/include/isc/list.h @@ -0,0 +1,119 @@ +/* + * Copyright (c) 1998-2001 by Sun Microsystems, Inc. + * All rights reserved. + */ + +/* + * Copyright (c) 1997,1999 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifndef LIST_H +#define LIST_H 1 +#include <isc/assertions.h> + +#define LIST(type) struct { type *head, *tail; } +#define INIT_LIST(list) \ + do { (list).head = NULL; (list).tail = NULL; } while (0) + +#define LINK(type) struct { type *prev, *next; } +#define INIT_LINK_TYPE(elt, link, type) \ + do { \ + (elt)->link.prev = (type *)(-1); \ + (elt)->link.next = (type *)(-1); \ + } while (0) +#define INIT_LINK(elt, link) \ + INIT_LINK_TYPE(elt, link, void) +#define LINKED(elt, link) ((void *)((elt)->link.prev) != (void *)(-1)) + +#define HEAD(list) ((list).head) +#define TAIL(list) ((list).tail) +#define EMPTY(list) ((list).head == NULL) + +#define PREPEND(list, elt, link) \ + do { \ + INSIST(!LINKED(elt, link));\ + if ((list).head != NULL) \ + (list).head->link.prev = (elt); \ + else \ + (list).tail = (elt); \ + (elt)->link.prev = NULL; \ + (elt)->link.next = (list).head; \ + (list).head = (elt); \ + } while (0) + +#define APPEND(list, elt, link) \ + do { \ + INSIST(!LINKED(elt, link));\ + if ((list).tail != NULL) \ + (list).tail->link.next = (elt); \ + else \ + (list).head = (elt); \ + (elt)->link.prev = (list).tail; \ + (elt)->link.next = NULL; \ + (list).tail = (elt); \ + } while (0) + +#define UNLINK_TYPE(list, elt, link, type) \ + do { \ + INSIST(LINKED(elt, link));\ + if ((elt)->link.next != NULL) \ + (elt)->link.next->link.prev = (elt)->link.prev; \ + else \ + (list).tail = (elt)->link.prev; \ + if ((elt)->link.prev != NULL) \ + (elt)->link.prev->link.next = (elt)->link.next; \ + else \ + (list).head = (elt)->link.next; \ + INIT_LINK_TYPE(elt, link, type); \ + } while (0) +#define UNLINK(list, elt, link) \ + UNLINK_TYPE(list, elt, link, void) + +#define PREV(elt, link) ((elt)->link.prev) +#define NEXT(elt, link) ((elt)->link.next) + +#define INSERT_BEFORE(list, before, elt, link) \ + do { \ + INSIST(!LINKED(elt, link));\ + if ((before)->link.prev == NULL) \ + PREPEND(list, elt, link); \ + else { \ + (elt)->link.prev = (before)->link.prev; \ + (before)->link.prev = (elt); \ + (elt)->link.prev->link.next = (elt); \ + (elt)->link.next = (before); \ + } \ + } while (0) + +#define INSERT_AFTER(list, after, elt, link) \ + do { \ + INSIST(!LINKED(elt, link));\ + if ((after)->link.next == NULL) \ + APPEND(list, elt, link); \ + else { \ + (elt)->link.next = (after)->link.next; \ + (after)->link.next = (elt); \ + (elt)->link.next->link.prev = (elt); \ + (elt)->link.prev = (after); \ + } \ + } while (0) + +#define ENQUEUE(list, elt, link) APPEND(list, elt, link) +#define DEQUEUE(list, elt, link) UNLINK(list, elt, link) + +#endif /* LIST_H */ diff --git a/usr/src/lib/libresolv2/include/isc/logging.h b/usr/src/lib/libresolv2/include/isc/logging.h new file mode 100644 index 0000000000..99f0e40fea --- /dev/null +++ b/usr/src/lib/libresolv2/include/isc/logging.h @@ -0,0 +1,118 @@ +/* + * Copyright 2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * Copyright (c) 1996-1999 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifndef LOGGING_H +#define LOGGING_H + +#include <sys/types.h> +#include <stdio.h> +#include <stdarg.h> +#include <unistd.h> + +#define log_critical (-5) +#define log_error (-4) +#define log_warning (-3) +#define log_notice (-2) +#define log_info (-1) +#define log_debug(level) (level) + +typedef enum { log_syslog, log_file, log_null } log_channel_type; + +#define LOG_MAX_VERSIONS 99 + +#define LOG_CLOSE_STREAM 0x0001 +#define LOG_TIMESTAMP 0x0002 +#define LOG_TRUNCATE 0x0004 +#define LOG_USE_CONTEXT_LEVEL 0x0008 +#define LOG_PRINT_LEVEL 0x0010 +#define LOG_REQUIRE_DEBUG 0x0020 +#define LOG_CHANNEL_BROKEN 0x0040 +#define LOG_PRINT_CATEGORY 0x0080 +#define LOG_CHANNEL_OFF 0x0100 + +typedef struct log_context *log_context; +typedef struct log_channel *log_channel; + +#define LOG_OPTION_DEBUG 0x01 +#define LOG_OPTION_LEVEL 0x02 + +#define log_open_stream __log_open_stream +#define log_close_stream __log_close_stream +#define log_get_stream __log_get_stream +#define log_get_filename __log_get_filename +#define log_check_channel __log_check_channel +#define log_check __log_check +#define log_vwrite __log_vwrite +#define log_write __log_write +#define log_new_context __log_new_context +#define log_free_context __log_free_context +#define log_add_channel __log_add_channel +#define log_remove_channel __log_remove_channel +#define log_option __log_option +#define log_category_is_active __log_category_is_active +#define log_new_syslog_channel __log_new_syslog_channel +#define log_new_file_channel __log_new_file_channel +#define log_set_file_owner __log_set_file_owner +#define log_new_null_channel __log_new_null_channel +#define log_inc_references __log_inc_references +#define log_dec_references __log_dec_references +#define log_get_channel_type __log_get_channel_type +#define log_free_channel __log_free_channel +#define log_close_debug_channels __log_close_debug_channels + +FILE * log_open_stream(log_channel); +int log_close_stream(log_channel); +FILE * log_get_stream(log_channel); +char * log_get_filename(log_channel); +int log_check_channel(log_context, int, log_channel); +int log_check(log_context, int, int); +#ifdef __GNUC__ +void log_vwrite(log_context, int, int, const char *, + va_list args) + __attribute__((__format__(__printf__, 4, 0))); +void log_write(log_context, int, int, const char *, ...) + __attribute__((__format__(__printf__, 4, 5))); +#else +void log_vwrite(log_context, int, int, const char *, + va_list args); +void log_write(log_context, int, int, const char *, ...); +#endif +int log_new_context(int, char **, log_context *); +void log_free_context(log_context); +int log_add_channel(log_context, int, log_channel); +int log_remove_channel(log_context, int, log_channel); +int log_option(log_context, int, int); +int log_category_is_active(log_context, int); +log_channel log_new_syslog_channel(unsigned int, int, int); +log_channel log_new_file_channel(unsigned int, int, const char *, + FILE *, unsigned int, + unsigned long); +int log_set_file_owner(log_channel, uid_t, gid_t); +log_channel log_new_null_channel(void); +int log_inc_references(log_channel); +int log_dec_references(log_channel); +log_channel_type log_get_channel_type(log_channel); +int log_free_channel(log_channel); +void log_close_debug_channels(log_context); + +#endif /* !LOGGING_H */ diff --git a/usr/src/lib/libresolv2/include/isc/memcluster.h b/usr/src/lib/libresolv2/include/isc/memcluster.h new file mode 100644 index 0000000000..28e7c444a8 --- /dev/null +++ b/usr/src/lib/libresolv2/include/isc/memcluster.h @@ -0,0 +1,56 @@ +/* + * Copyright 1998-2002 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * Copyright (c) 1997,1999 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifndef MEMCLUSTER_H +#define MEMCLUSTER_H + +#include <stdio.h> + +#define meminit __meminit +#ifdef MEMCLUSTER_DEBUG +#define memget(s) __memget_debug(s, __FILE__, __LINE__) +#define memput(p, s) __memput_debug(p, s, __FILE__, __LINE__) +#else /*MEMCLUSTER_DEBUG*/ +#ifdef MEMCLUSTER_RECORD +#define memget(s) __memget_record(s, __FILE__, __LINE__) +#define memput(p, s) __memput_record(p, s, __FILE__, __LINE__) +#else /*MEMCLUSTER_RECORD*/ +#define memget __memget +#define memput __memput +#endif /*MEMCLUSTER_RECORD*/ +#endif /*MEMCLUSTER_DEBUG*/ +#define memstats __memstats +#define memactive __memactive + +int meminit(size_t, size_t); +void * __memget(size_t); +void __memput(void *, size_t); +void * __memget_debug(size_t, const char *, int); +void __memput_debug(void *, size_t, const char *, int); +void * __memget_record(size_t, const char *, int); +void __memput_record(void *, size_t, const char *, int); +void memstats(FILE *); +int memactive(void); + +#endif /* MEMCLUSTER_H */ diff --git a/usr/src/lib/libresolv2/include/isc/misc.h b/usr/src/lib/libresolv2/include/isc/misc.h new file mode 100644 index 0000000000..89afbc6c51 --- /dev/null +++ b/usr/src/lib/libresolv2/include/isc/misc.h @@ -0,0 +1,44 @@ +/* + * Copyright 1997-2002 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * Copyright (c) 1995-1999 by Internet Software Consortium + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +/* + * $Id: misc.h,v 8.5 2001/06/18 06:40:43 marka Exp $ + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifndef _ISC_MISC_H +#define _ISC_MISC_H + +#include <stdio.h> + +#define bitncmp __bitncmp + +extern int bitncmp(const void *l, const void *r, int n); + +extern int isc_gethexstring(unsigned char *, size_t, int, FILE *, + int *); +extern void isc_puthexstring(FILE *, const unsigned char *, size_t, + size_t, size_t, const char *); +extern void isc_tohex(const unsigned char *, size_t, char *); + +#endif /*_ISC_MISC_H*/ diff --git a/usr/src/lib/libresolv2/include/isc/tree.h b/usr/src/lib/libresolv2/include/isc/tree.h new file mode 100644 index 0000000000..384832830c --- /dev/null +++ b/usr/src/lib/libresolv2/include/isc/tree.h @@ -0,0 +1,66 @@ +/* + * Copyright 2003 by Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* tree.h - declare structures used by tree library + * + * vix 22jan93 [revisited; uses RCS, ANSI, POSIX; has bug fixes] + * vix 27jun86 [broken out of tree.c] + * + * $Id: tree.h,v 8.3 2002/12/03 05:26:48 marka Exp $ + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifndef _TREE_H_INCLUDED +#define _TREE_H_INCLUDED + + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + +/* + * tree_t is our package-specific anonymous pointer. + */ +#if defined(__STDC__) || defined(__GNUC__) +typedef void *tree_t; +#else +typedef char *tree_t; +#endif + +#ifdef ORIGINAL_ISC_CODE +/* + * Do not taint namespace + */ +#define tree_add __tree_add +#define tree_delete __tree_delete +#define tree_init __tree_init +#define tree_mung __tree_mung +#define tree_srch __tree_srch +#define tree_trav __tree_trav +#else +#endif + +typedef struct tree_s { + tree_t data; + struct tree_s *left, *right; + short bal; + } + tree; + + +void tree_init __P((tree **)); +tree_t tree_srch __P((tree **, int (*)(), tree_t)); +tree_t tree_add __P((tree **, int (*)(), tree_t, void (*)())); +int tree_delete __P((tree **, int (*)(), tree_t, void (*)())); +int tree_trav __P((tree **, int (*)())); +void tree_mung __P((tree **, void (*)())); + + +#endif /* _TREE_H_INCLUDED */ diff --git a/usr/src/lib/libresolv2/include/make_os_version b/usr/src/lib/libresolv2/include/make_os_version new file mode 100644 index 0000000000..3654490fee --- /dev/null +++ b/usr/src/lib/libresolv2/include/make_os_version @@ -0,0 +1,34 @@ +#!/bin/sh + +# Copyright (c) 1999 by Sun Microsystems, Inc. +# All rights reserved. +# +#pragma ident "%Z%%M% %I% %E% SMI" + +UNAME_R=`/usr/bin/uname -r` + +OS_MAJOR=`echo $UNAME_R | /usr/bin/sed -e 's/^\([^.]*\).*/\1/'` +OS_MINOR=`echo $UNAME_R | /usr/bin/sed -e 's/^[^.]*\.\([^.]*\).*/\1/'` +OS_VERSION=`echo $UNAME_R | tr '.' '_'` + +cat <<EOF > new_os_version.h +#ifndef OS_VERSION_H +#define OS_VERSION_H + +#define SUNOS_$OS_VERSION +#define OS_MAJOR $OS_MAJOR +#define OS_MINOR $OS_MINOR + +#endif +EOF + +if [ -f os_version.h ]; then + if /usr/bin/cmp -s new_os_version.h os_version.h; then + /usr/bin/rm -f new_os_version.h + else + /usr/bin/rm -f os_version.h + /usr/bin/mv new_os_version.h os_version.h + fi +else + /usr/bin/mv new_os_version.h os_version.h +fi diff --git a/usr/src/lib/libresolv2/include/netdb_private.h b/usr/src/lib/libresolv2/include/netdb_private.h new file mode 100644 index 0000000000..58a6c5905f --- /dev/null +++ b/usr/src/lib/libresolv2/include/netdb_private.h @@ -0,0 +1,41 @@ +/* + * Copyright 1999-2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _NETDB_PRIVATE_H +#define _NETDB_PRIVATE_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * Constants defined by the ISC for BIND 8.2, but which do not appear + * in RFC 2553 (hence, aren't suitable for inclusion in <netdb.h>). + */ + +/* + * Error return codes from getaddrinfo() + */ + +#define EAI_BADHINTS 12 +#define EAI_PROTOCOL 13 +#define EAI_MAX 14 + +/* + * Flag values for getaddrinfo() + */ + +#define AI_MASK 0x00000007 + +/* + * Scope delimit character + */ +#define SCOPE_DELIMITER '%' + +/* + * XXX + * Various data types (hostent_data, netent_data, protoent_data, servent_data) + * only defined for __osf__ or __hpux => we don't need them ?? + */ + +#endif /* _NETDB_PRIVATE_H */ diff --git a/usr/src/lib/libresolv2/include/netgroup.h b/usr/src/lib/libresolv2/include/netgroup.h new file mode 100644 index 0000000000..36cc9a742f --- /dev/null +++ b/usr/src/lib/libresolv2/include/netgroup.h @@ -0,0 +1,26 @@ +/* + * Copyright 2002 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef ORIGINAL_ISC_CODE +#ifndef netgroup_h +#define netgroup_h + +int getnetgrent(const char **machinep, const char **userp, + const char **domainp); + +int getnetgrent_r(char **machinep, char **userp, char **domainp, + char *buffer, int buflen); + +void setnetgrent(const char *netgroup); + +void endnetgrent(void); + +int innetgr(const char *netgroup, const char *machine, + const char *user, const char *domain); + +#endif +#endif /* ORIGINAL_ISC_CODE */ diff --git a/usr/src/lib/libresolv2/include/paths.h b/usr/src/lib/libresolv2/include/paths.h new file mode 100644 index 0000000000..648c624e02 --- /dev/null +++ b/usr/src/lib/libresolv2/include/paths.h @@ -0,0 +1,9 @@ +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +#define _PATH_DEVNULL "/dev/null" + diff --git a/usr/src/lib/libresolv2/include/port_after.h b/usr/src/lib/libresolv2/include/port_after.h new file mode 100644 index 0000000000..2f449c0a7a --- /dev/null +++ b/usr/src/lib/libresolv2/include/port_after.h @@ -0,0 +1,294 @@ +/* + * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifndef PORT_AFTER_H +#define PORT_AFTER_H +#include "os_version.h" + +#undef HAVE_SA_LEN +#define USE_POSIX +#define POSIX_SIGNALS +#define NETREAD_BROKEN +#define USE_WAITPID +#define HAVE_FCHMOD +#define NEED_PSELECT +#define SETGRENT_VOID +#define SETPWENT_VOID +#define SIOCGIFCONF_ADDR +#define IP_OPT_BUF_SIZE 40 +#define HAVE_CHROOT +#define CAN_CHANGE_ID +#define POSIX_GETPWNAM_R +#define POSIX_GETPWUID_R +#define POSIX_GETGRGID_R +#define POSIX_GETGRNAM_R +#define NEED_SECURE_DIRECTORY +#define HAVE_DEV_RANDOM +#define NO_MSG_CONTROL + +#define PORT_NONBLOCK O_NONBLOCK +#define PORT_WOULDBLK EWOULDBLOCK +#define WAIT_T int +#ifndef SUNW_LIBNSL +#define INADDR_NONE 0xffffffff +#endif + +#include <sys/types.h> +#include <sys/socket.h> +#include <sys/param.h> +#if (!defined(BSD)) || (BSD < 199306) +#include <sys/bitypes.h> +#endif +#include <sys/time.h> + +#ifndef MIN +#define MIN(x, y) ((x > y) ?y :x) +#endif +#ifndef MAX +#define MAX(x, y) ((x > y) ?x :y) +#endif + +/* + * We need to know the IPv6 address family number even on IPv4-only systems. + * Note that this is NOT a protocol constant, and that if the system has its + * own AF_INET6, different from ours below, all of BIND's libraries and + * executables will need to be recompiled after the system <sys/socket.h> + * has had this type added. The type number below is correct on most BSD- + * derived systems for which AF_INET6 is defined. + */ +#ifndef AF_INET6 +#define AF_INET6 24 +#endif + +#ifndef PF_INET6 +#define PF_INET6 AF_INET6 +#endif +#include <port_ipv6.h> + +#ifndef HAS_INET6_STRUCTS +/* Replace with structure from later rev of O/S if known. */ +struct in6_addr { + u_int8_t s6_addr[16]; +}; + +/* Replace with structure from later rev of O/S if known. */ +struct sockaddr_in6 { +#ifdef HAVE_SA_LEN + u_int8_t sin6_len; /* length of this struct */ + u_int8_t sin6_family; /* AF_INET6 */ +#else + u_int16_t sin6_family; /* AF_INET6 */ +#endif + u_int16_t sin6_port; /* transport layer port # */ + u_int32_t sin6_flowinfo; /* IPv6 flow information */ + struct in6_addr sin6_addr; /* IPv6 address */ + u_int32_t sin6_scope_id; /* set of interfaces for a scope */ +}; + +#ifndef IN6ADDR_ANY_INIT +#define IN6ADDR_ANY_INIT {{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}} +#endif +#ifndef IN6ADDR_LOOPBACK_INIT +#define IN6ADDR_LOOPBACK_INIT {{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}} +#endif +#endif /* HAS_INET6_STRUCTS */ + +#if defined(NEED_SOCKADDR_STORAGE) || !defined(HAS_INET6_STRUCTS) +#define __SS_MAXSIZE 128 +#define __SS_ALLIGSIZE (sizeof (long)) + +struct sockaddr_storage { +#ifdef HAVE_SA_LEN + u_int8_t ss_len; /* address length */ + u_int8_t ss_family; /* address family */ + char __ss_pad1[__SS_ALLIGSIZE - 2 * sizeof (u_int8_t)]; + long __ss_align; + char __ss_pad2[__SS_MAXSIZE - 2 * __SS_ALLIGSIZE]; +#else + u_int16_t ss_family; /* address family */ + char __ss_pad1[__SS_ALLIGSIZE - sizeof (u_int16_t)]; + long __ss_align; + char __ss_pad2[__SS_MAXSIZE - 2 * __SS_ALLIGSIZE]; +#endif +}; +#endif + + +#if !defined(HAS_INET6_STRUCTS) || defined(NEED_IN6ADDR_ANY) +#define in6addr_any isc_in6addr_any +extern const struct in6_addr in6addr_any; +#endif + +#ifndef IN6_ARE_ADDR_EQUAL +#define IN6_ARE_ADDR_EQUAL(a, b) \ + (memcmp(&(a)->s6_addr[0], &(b)->s6_addr[0], sizeof (struct in6_addr)) == 0) +#endif + +#ifndef IN6_IS_ADDR_UNSPECIFIED +#define IN6_IS_ADDR_UNSPECIFIED(a) \ + IN6_ARE_ADDR_EQUAL(a, &in6addr_any) +#endif + +#ifndef IN6_IS_ADDR_LOOPBACK +extern const struct in6_addr isc_in6addr_loopback; +#define IN6_IS_ADDR_LOOPBACK(a) \ + IN6_ARE_ADDR_EQUAL(a, &isc_in6addr_loopback) +#endif + +#ifndef IN6_IS_ADDR_V4COMPAT +#define IN6_IS_ADDR_V4COMPAT(a) \ + ((a)->s6_addr[0] == 0x00 && (a)->s6_addr[1] == 0x00 && \ + (a)->s6_addr[2] == 0x00 && (a)->s6_addr[3] == 0x00 && \ + (a)->s6_addr[4] == 0x00 && (a)->s6_addr[5] == 0x00 && \ + (a)->s6_addr[6] == 0x00 && (a)->s6_addr[7] == 0x00 && \ + (a)->s6_addr[8] == 0x00 && (a)->s6_addr[9] == 0x00 && \ + (a)->s6_addr[10] == 0x00 && (a)->s6_addr[11] == 0x00 && \ + ((a)->s6_addr[12] != 0x00 || (a)->s6_addr[13] != 0x00 || \ + (a)->s6_addr[14] != 0x00 || \ + ((a)->s6_addr[15] != 0x00 && (a)->s6_addr[15] != 1))) +#endif + +#ifndef IN6_IS_ADDR_V4MAPPED +#define IN6_IS_ADDR_V4MAPPED(a) \ + ((a)->s6_addr[0] == 0x00 && (a)->s6_addr[1] == 0x00 && \ + (a)->s6_addr[2] == 0x00 && (a)->s6_addr[3] == 0x00 && \ + (a)->s6_addr[4] == 0x00 && (a)->s6_addr[5] == 0x00 && \ + (a)->s6_addr[6] == 0x00 && (a)->s6_addr[7] == 0x00 && \ + (a)->s6_addr[8] == 0x00 && (a)->s6_addr[9] == 0x00 && \ + (a)->s6_addr[10] == 0xff && (a)->s6_addr[11] == 0xff) +#endif + +#ifndef IN6_IS_ADDR_SITELOCAL +#define IN6_IS_ADDR_SITELOCAL(a) \ + (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0xc0)) +#endif + +#ifndef IN6_IS_ADDR_LINKLOCAL +#define IN6_IS_ADDR_LINKLOCAL(a) \ + (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0x80)) +#endif + +#ifndef IN6_IS_ADDR_MULTICAST +#define IN6_IS_ADDR_MULTICAST(a) ((a)->s6_addr[0] == 0xff) +#endif + +#ifndef __IPV6_ADDR_MC_SCOPE +#define __IPV6_ADDR_MC_SCOPE(a) ((a)->s6_addr[1] & 0x0f) +#endif + +#ifndef __IPV6_ADDR_SCOPE_SITELOCAL +#define __IPV6_ADDR_SCOPE_SITELOCAL 0x05 +#endif + +#ifndef __IPV6_ADDR_SCOPE_ORGLOCAL +#define __IPV6_ADDR_SCOPE_ORGLOCAL 0x08 +#endif + +#ifndef IN6_IS_ADDR_MC_SITELOCAL +#define IN6_IS_ADDR_MC_SITELOCAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) && \ + (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_SITELOCAL)) +#endif + +#ifndef IN6_IS_ADDR_MC_ORGLOCAL +#define IN6_IS_ADDR_MC_ORGLOCAL(a) \ + (IN6_IS_ADDR_MULTICAST(a) && \ + (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_ORGLOCAL)) +#endif + +#ifndef INET6_ADDRSTRLEN +#define INET6_ADDRSTRLEN 46 +#endif + +/* + * Prior to 2.6, Solaris needs a prototype for gethostname(). + */ +#if (OS_MAJOR == 5 && OS_MINOR < 6) +extern int gethostname(char *, size_t); +#endif +/* + * gethostid() was not available until 2.5 + * setsockopt(SO_REUSEADDR) fails on unix domain sockets before 2.5 + * use ioctl(FIONBIO) rather than fcntl() calls to set/clear non-blocking i/o. + */ +#if (OS_MAJOR == 5 && OS_MINOR < 5) +#define GET_HOST_ID_MISSING +#define NO_UNIX_REUSEADDR +#define USE_FIONBIO_IOCTL +#endif + +#define NEED_STRSEP +extern char *strsep(char **, const char *); + +#define NEED_DAEMON +int daemon(int nochdir, int noclose); + +/* + * Solaris defines this in <netdb.h> instead of in <sys/param.h>. We don't + * define it in our <netdb.h>, so we define it here. + */ +#ifndef MAXHOSTNAMELEN +#define MAXHOSTNAMELEN 256 +#endif + +/* + * Solaris 2.5 and later have getrlimit(), setrlimit() and getrusage(). + */ +#if (OS_MAJOR > 5 || (OS_MAJOR == 5 && OS_MINOR >= 5)) +#include <sys/resource.h> +#define HAVE_GETRUSAGE +#define RLIMIT_TYPE rlim_t +#define RLIMIT_FILE_INFINITY +#endif + +#include <resolv_mt.h> +#include <netdb_private.h> +#include <inet_private.h> +#include <ctype.h> +#include <sunw_dst_init.h> +#include <sunw_irs_init.h> + +#ifdef ORIGINAL_ISC_CODE +const char *isc_strerror(int errnum); +#define strerror isc_strerror +#endif + +#ifndef ISC_FACILITY +#define ISC_FACILITY LOG_DAEMON +#endif + +/* res_mkquery.c refers explicitly to __putlong and __putshort */ +#define __putlong putlong +#define __putshort putshort + +/* + * If one wanted to use isc__gettimeofday for Solaris, they would + * need to define NEED_GETTIMEOFDAY (common/bsd/gettimeofday.c), + * which is not defined for Solaris. Hence there is no reason to + * change the current definition of gettimeofday which currently + * comes from libc and we comment the following out. + */ +#ifdef ORIGINAL_ISC_CODE +int isc__gettimeofday(struct timeval *, struct timezone *); +#define gettimeofday isc__gettimeofday +#endif + +/* + * Solaris 8 has if_nametoindex(). + */ +#if (OS_MAJOR > 5 || (OS_MAJOR == 5 && OS_MINOR >= 8)) +#define USE_IFNAMELINKID +#endif + +#define UNUSED(x) (x) = (x) +#define DE_CONST(konst, var) \ + do { \ + union { const void *k; void *v; } _u; \ + _u.k = konst; \ + var = _u.v; \ + } while (0) +#endif /* ! PORT_AFTER_H */ diff --git a/usr/src/lib/libresolv2/include/port_before.h b/usr/src/lib/libresolv2/include/port_before.h new file mode 100644 index 0000000000..32595ef5e0 --- /dev/null +++ b/usr/src/lib/libresolv2/include/port_before.h @@ -0,0 +1,159 @@ +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef SUNW_OPTIONS +#include "conf/sunoptions.h" +#endif + +#define __EXTENSIONS__ +/* #define SVR4 */ +#ifdef WANT_IRS_NIS +#undef WANT_IRS_NIS +#endif +#undef WANT_IRS_PW +#undef WANT_IRS_GR +#define SIG_FN void +#define ISC_SOCKLEN_T int +#include "os_version.h" +#if (OS_MAJOR == 5 && OS_MINOR < 5) +#undef HAS_PTHREADS +#else +#define HAS_PTHREADS +#endif + +#if defined(HAS_PTHREADS) && defined(_REENTRANT) +#define DO_PTHREADS +#endif + +#define GROUP_R_RETURN struct group * +#define GROUP_R_SET_RETURN void +#undef GROUP_R_SET_RESULT /*empty*/ +#define GROUP_R_END_RETURN void +#undef GROUP_R_END_RESULT /*empty*/ +#define GROUP_R_ARGS char *buf, int buflen +#undef GROUP_R_ENT_ARGS /*empty*/ +#define GROUP_R_OK gptr +#define GROUP_R_BAD NULL +#define GETGROUPLIST_ARGS const char *name, gid_t basegid, gid_t *groups, \ + int *ngroups + +#define HOST_R_RETURN struct hostent * +#define HOST_R_SET_RETURN void +#undef HOST_R_SET_RESULT /*empty*/ +#define HOST_R_END_RETURN void +#define HOST_R_END_RESULT(x) /*empty*/ +#define HOST_R_ARGS char *buf, int buflen, int *h_errnop +#undef HOST_R_ENT_ARGS /*empty*/ +#define HOST_R_COPY buf, buflen +#define HOST_R_COPY_ARGS char *buf, int buflen +#define HOST_R_ERRNO *h_errnop = h_errno +#define HOST_R_OK hptr +#define HOST_R_BAD NULL + +#define NET_R_RETURN struct netent * +#define NET_R_SET_RETURN void +#undef NET_R_SET_RESULT /*empty*/ +#define NET_R_END_RETURN void +#define NET_R_END_RESULT(x) /*empty*/ +#define NET_R_ARGS char *buf, int buflen +#undef NET_R_ENT_ARGS /*empty*/ +#define NET_R_COPY buf, buflen +#define NET_R_COPY_ARGS NET_R_ARGS +#define NET_R_OK nptr +#define NET_R_BAD NULL + +#define NGR_R_RETURN int +#define NGR_R_SET_RETURN void +#undef NGR_R_SET_RESULT /*empty*/ +#define NGR_R_END_RETURN void +#ifdef ORIGINAL_ISC_CODE +#undef NGR_R_END_RESULT /*empty*/ +#else +#define NGR_R_END_RESULT(x) /*empty*/ +#endif +#define NGR_R_ARGS char *buf, int buflen +#undef NGR_R_ENT_ARGS /*empty*/ +#define NGR_R_COPY buf, buflen +#define NGR_R_COPY_ARGS NGR_R_ARGS +#define NGR_R_OK 1 +#define NGR_R_BAD (0) + +#define PROTO_R_RETURN struct protoent * +#define PROTO_R_SET_RETURN void +#undef PROTO_R_SET_RESULT /*empty*/ +#define PROTO_R_END_RETURN void +#define PROTO_R_END_RESULT(x) /*empty*/ +#define PROTO_R_ARGS char *buf, int buflen +#undef PROTO_R_ENT_ARGS /*empty*/ +#define PROTO_R_COPY buf, buflen +#define PROTO_R_COPY_ARGS PROTO_R_ARGS +#define PROTO_R_OK pptr +#define PROTO_R_BAD NULL + +#define PASS_R_RETURN struct passwd * +#define PASS_R_SET_RETURN void +#undef PASS_R_SET_RESULT /*empty*/ +#define PASS_R_END_RETURN void +#undef PASS_R_END_RESULT /*empty*/ +#define PASS_R_ARGS char *buf, int buflen +#undef PASS_R_ENT_ARGS /*empty*/ +#define PASS_R_COPY buf, buflen +#define PASS_R_COPY_ARGS PASS_R_ARGS +#define PASS_R_OK pwptr +#define PASS_R_BAD NULL + +#define SERV_R_RETURN struct servent * +#define SERV_R_SET_RETURN void +#undef SERV_R_SET_RESULT /*empty*/ +#define SERV_R_END_RETURN void +#define SERV_R_END_RESULT(x) /*empty*/ +#define SERV_R_ARGS char *buf, int buflen +#undef SERV_R_ENT_ARGS /*empty*/ +#define SERV_R_COPY buf, buflen +#define SERV_R_COPY_ARGS SERV_R_ARGS +#define SERV_R_OK sptr +#define SERV_R_BAD NULL + +/* make #include <sys/ioctl.h> also #include <sys/sockio.h> */ +#define BSD_COMP + +#include <limits.h> /* _POSIX_PATH_MAX */ + +#ifdef __GNUC__ +#define ISC_FORMAT_PRINTF(fmt, args) \ + __attribute__((__format__(__printf__, fmt, args))) +#else +#define ISC_FORMAT_PRINTF(fmt, args) +#endif + +/* + * Several files in the ISC distribution use an ALIGN macro which doesn't + * appear to be defined anywhere. From the context, it's intended to round + * up its argument to the nearest suitable boundary. We'll guess that eight + * byte alignment is sufficient. + */ +#define ALIGN(p) (uint64_t)(((uintptr_t)(p) + (sizeof (uint64_t) - 1)) \ + & ~(sizeof (uint64_t) - 1)) + +#ifdef SUNW_SYNONYMS +#include "synonyms.h" +#endif + +/* + * Remove compiler warnings without modifying ISC source by including + * various headers here, mostly to get function prototypes. + */ +#include <string.h> +#include <strings.h> +#include <unistd.h> + +#include <sys/types.h> +#include "sys/bitypes.h" +#include "sys/cdefs.h" + +#define HAS_INET6_STRUCTS +#define H_ERRNO_IS_FUNCTION diff --git a/usr/src/lib/libresolv2/include/prand_conf.h b/usr/src/lib/libresolv2/include/prand_conf.h new file mode 100644 index 0000000000..89aa78295c --- /dev/null +++ b/usr/src/lib/libresolv2/include/prand_conf.h @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2001 by Sun Microsystems, Inc. + * All rights reserved. + * + * No ISC copyright for this file. + */ + +#ifndef _PRAND_CMD_H_ +#define _PRAND_CMD_H_ + +#pragma ident "%Z%%M% %I% %E% SMI" + +static const char *cmds[] = { + "/bin/ps -ef 2>&1", + "/usr/ucb/netstat -an 2>&1", + "/bin/df 2>&1", + "/usr/bin/dig com. soa +ti=1 +retry=0 2>&1", + "/usr/ucb/uptime 2>&1", + "/usr/ucb/netstat -an 2>&1", + "/bin/iostat 2>&1", + NULL +}; + +static const char *dirs[] = { + "/tmp", + "/var/tmp", + ".", + "/", + "/var/spool", + "/var/adm", + "/dev", + "/var/mail", + "/home", + NULL +}; + +static const char *files[] = { + "/proc/self/status", + "/var/adm/messages", + "/var/adm/wtmp", + "/var/adm/lastlog", + NULL +}; + +#endif /* _PRAND_CMD_H_ */ diff --git a/usr/src/lib/libresolv2/include/probe_ipv6 b/usr/src/lib/libresolv2/include/probe_ipv6 new file mode 100644 index 0000000000..371ac96c55 --- /dev/null +++ b/usr/src/lib/libresolv2/include/probe_ipv6 @@ -0,0 +1,73 @@ +#!/bin/sh + +# Copyright 2003 by Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +#pragma ident "%Z%%M% %I% %E% SMI" + +set -e +PATH=/bin:/usr/bin:$PATH; export PATH +trap "rm -f tmp$$[abc].[oc]" 0 +target=port_ipv6 +new=new_${target}.h +old=${target}.h + +cat > tmp$$a.c <<EOF +#include <sys/types.h> +#include <netinet/in.h> +struct sockaddr_in6 xx; +EOF + +cat > tmp$$b.c <<EOF +#include <sys/types.h> +#include <netinet/in.h> +struct in6_addr xx; +EOF + +cat > tmp$$c.c <<EOF +#include <sys/types.h> +#include <netinet/in.h> +struct sockaddr_in6 xx; +main() { xx.sin6_scope_id = 0; } +EOF + +cat > ${new} <<EOF + +/* This file is automatically generated. Do Not Edit. */ + +#ifndef ${target}_h +#define ${target}_h + +EOF + +if ${CC} -c tmp$$a.c > /dev/null 2>&1 +then + echo "#define HAS_INET6_STRUCTS" >> ${new} + if ${CC} -c tmp$$b.c > /dev/null 2>&1 + then + : + else + echo "#define in6_addr in_addr6" >> ${new} + fi + if ${CC} -c tmp$$c.c > /dev/null 2>&1 + then + echo "#define HAVE_SIN6_SCOPE_ID" >> ${new} + else + echo "#undef HAVE_SIN6_SCOPE_ID" >> ${new} + fi +else + echo "#undef HAS_INET6_STRUCTS" >> ${new} +fi +echo >> ${new} +echo "#endif" >> ${new} +if [ -f ${old} ]; then + if cmp -s ${new} ${old} ; then + rm -f ${new} + else + rm -f ${old} + mv ${new} ${old} + fi +else + mv ${new} ${old} +fi +exit 0 diff --git a/usr/src/lib/libresolv2/include/res_update.h b/usr/src/lib/libresolv2/include/res_update.h new file mode 100644 index 0000000000..e2eb9c651f --- /dev/null +++ b/usr/src/lib/libresolv2/include/res_update.h @@ -0,0 +1,104 @@ +/* + * Copyright (c) 1999 by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * Copyright (c) 1999 by Internet Software Consortium, Inc. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +/* + * $Id: res_update.h,v 8.1 1999/10/07 08:24:13 vixie Exp $ + */ + +#ifndef __RES_UPDATE_H +#define __RES_UPDATE_H + +#include <sys/types.h> +#include <sys/bitypes.h> +#include <arpa/nameser.h> +#include <isc/list.h> +#include <resolv.h> + +#ifdef ORIGINAL_ISC_CODE +#else +/* + * ISC changed the ns_updrec structure. However, it's a public interface + * in Solaris, so it's time to break out that old #define magic. + */ +#define ns_updrec __ISC_ns_updrec +#endif /* ORIGINAL_ISC_CODE */ +/* + * This RR-like structure is particular to UPDATE. + */ +struct ns_updrec { + LINK(struct ns_updrec) r_link, r_glink; + ns_sect r_section; /* ZONE/PREREQUISITE/UPDATE */ + char * r_dname; /* owner of the RR */ + ns_class r_class; /* class number */ + ns_type r_type; /* type number */ + u_int32_t r_ttl; /* time to live */ + u_char * r_data; /* rdata fields as text string */ + u_int r_size; /* size of r_data field */ + int r_opcode; /* type of operation */ + /* following fields for private use by the resolver/server routines */ + struct databuf *r_dp; /* databuf to process */ + struct databuf *r_deldp; /* databuf's deleted/overwritten */ + u_int r_zone; /* zone number on server */ +}; +typedef struct ns_updrec ns_updrec; + +typedef LIST(ns_updrec) ns_updque; + +#ifdef ORIGINAL_ISC_CODE +#define res_mkupdate __res_mkupdate +#define res_update __res_update +#define res_mkupdrec __res_mkupdrec +#define res_freeupdrec __res_freeupdrec +#define res_nmkupdate __res_nmkupdate +#define res_nupdate __res_nupdate +#else +/* + * For BIND 8.2.2, ISC removed the dynamic update functions, and the + * definition of the ns_updrec structure, from the public include files + * (<resolv.h>, <arpa/nameser.h>. However, res_update(), res_mkupdate(), + * and res_mkupdrec() are in the public libresolv interface in Solaris, + * so we can't easily remove them. Thus, ISC's new versions of res_mkupdate() + * etc. can't be exposed under their original names. + * + * res_nmkupdate() and res_nupdate are new. We could either change them + * to accept the <arpa/nameser.h> ns_updrec, or leave them unchanged and + * undocumented. Since ISC may change ns_updrec again, we pick the latter + * solution for now. + */ +#define res_mkupdate __ISC_res_mkupdate +#define res_update __ISC_res_update +#define res_mkupdrec __ISC_res_mkupdrec +#define res_freeupdrec __ISC_res_freeupdrec +#define res_nmkupdate __ISC_res_nmkupdate +#define res_nupdate __ISC_res_nupdate +#endif /* ORIGINAL_ISC_CODE */ + +int res_mkupdate __P((ns_updrec *, u_char *, int)); +int res_update __P((ns_updrec *)); +ns_updrec * res_mkupdrec __P((int, const char *, u_int, u_int, u_long)); +void res_freeupdrec __P((ns_updrec *)); +int res_nmkupdate __P((res_state, ns_updrec *, u_char *, int)); +int res_nupdate __P((res_state, ns_updrec *, ns_tsig_key *)); + +#endif /*__RES_UPDATE_H*/ diff --git a/usr/src/lib/libresolv2/include/resolv_mt.h b/usr/src/lib/libresolv2/include/resolv_mt.h new file mode 100644 index 0000000000..e26fd18f02 --- /dev/null +++ b/usr/src/lib/libresolv2/include/resolv_mt.h @@ -0,0 +1,69 @@ +/* + * Copyright (c) 1998-1999 by Sun Microsystems, Inc. + */ + +#ifndef _RESOLV_MT_H +#define _RESOLV_MT_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef SUNW_MT_RESOLVER + +#include <sys/types.h> +#include <netinet/in.h> +#include <arpa/nameser.h> +#include <resolv.h> + +/* Access functions for the libresolv private interface */ + +int __res_enable_mt(void); +int __res_disable_mt(void); + +/* Per-thread context */ + +typedef struct { +#ifdef SUNW_HOSTS_FALLBACK + int no_hosts_fallback_private; +#endif /* SUNW_HOSTS_FALLBACK */ +#ifdef SUNW_OVERRIDE_RETRY + int retry_save; + int retry_private; +#endif /* SUNW_OVERRIDE_RETRY */ + char inet_nsap_ntoa_tmpbuf[255*3]; + char sym_ntos_unname[20]; + char sym_ntop_unname[20]; + char p_option_nbuf[40]; + char p_time_nbuf[40]; + char precsize_ntoa_retbuf[sizeof "90000000.00"]; + char loc_ntoa_tmpbuf[sizeof +"1000 60 60.000 N 1000 60 60.000 W -12345678.00m 90000000.00m 90000000.00m 90000000.00m"]; + char p_secstodate_output[15]; +} mtctxres_t; + +/* Thread-specific data (TSD) */ + +extern mtctxres_t *___mtctxres(); +#define mtctxres (___mtctxres()) + +/* Various static data that should be TSD */ + +#define sym_ntos_unname (mtctxres->sym_ntos_unname) +#define sym_ntop_unname (mtctxres->sym_ntop_unname) +#define inet_nsap_ntoa_tmpbuf (mtctxres->inet_nsap_ntoa_tmpbuf) +#define p_option_nbuf (mtctxres->p_option_nbuf) +#define p_time_nbuf (mtctxres->p_time_nbuf) +#define precsize_ntoa_retbuf (mtctxres->precsize_ntoa_retbuf) +#define loc_ntoa_tmpbuf (mtctxres->loc_ntoa_tmpbuf) +#define p_secstodate_output (mtctxres->p_secstodate_output) + +#endif /* SUNW_MT_RESOLVER */ + +#ifdef __cplusplus +} +#endif + +#endif /* _RESOLV_MT_H */ diff --git a/usr/src/lib/libresolv2/include/sunw_dst_init.h b/usr/src/lib/libresolv2/include/sunw_dst_init.h new file mode 100644 index 0000000000..72a93e3d70 --- /dev/null +++ b/usr/src/lib/libresolv2/include/sunw_dst_init.h @@ -0,0 +1,27 @@ +/* + * Copyright (c) 1999 by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifndef _SUNW_DST_INIT_H +#define _SUNW_DST_INIT_H + +extern int sunw_dst_bsafe_init(void); +extern int sunw_dst_rsaref_init(void); +extern int sunw_dst_hmac_md5_init(void); +extern int sunw_dst_eay_dss_init(void); +extern int sunw_dst_cylink_init(void); + +#ifndef __SUNW_DST_INIT_NODEFINE + +#define dst_bsafe_init sunw_dst_bsafe_init +#define dst_rsaref_init sunw_dst_rsaref_init +#define dst_hmac_md5_init sunw_dst_hmac_md5_init +#define dst_eay_dss_init sunw_dst_eay_dss_init +#define dst_cylink_init sunw_dst_cylink_init + +#endif /* __SUNW_DST_INIT_NODEFINE */ + +#endif /* _SUNW_DST_INIT_H */ diff --git a/usr/src/lib/libresolv2/include/sunw_irs_init.h b/usr/src/lib/libresolv2/include/sunw_irs_init.h new file mode 100644 index 0000000000..d249a0f7e6 --- /dev/null +++ b/usr/src/lib/libresolv2/include/sunw_irs_init.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 1999 by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifndef _SUNW_IRS_INIT_H +#define _SUNW_IRS_INIT_H + +extern struct irs_acc *sunw_irs_nis_acc(const char *); +extern struct irs_acc *sunw_irs_irp_acc(const char *); + +#ifndef __SUNW_IRS_INIT_NODEFINE + +#define __irs_nis_acc sunw_irs_nis_acc +#define __irs_irp_acc sunw_irs_irp_acc + +#endif /* __SUNW_IRS_INIT_NODEFINE */ + +#endif /* _SUNW_IRS_INIT_H */ diff --git a/usr/src/lib/libresolv2/include/synonyms.h b/usr/src/lib/libresolv2/include/synonyms.h new file mode 100644 index 0000000000..a1a17fb7d4 --- /dev/null +++ b/usr/src/lib/libresolv2/include/synonyms.h @@ -0,0 +1,564 @@ +/* + * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +#ifndef _SYNONYMS_H +#define _SYNONYMS_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(__STDC__) + +/* external data */ +#define altzone _altzone +#define daylight _daylight +#define lone _lone +#define lten _lten +#define lzero _lzero +#define timezone _timezone +#define tzname _tzname + +/* functions */ +#define Msgdb _Msgdb +#define a64l _a64l +#define access _access +#define acct _acct +#define acl _acl +#define addseverity _addseverity +#define adjtime _adjtime +#define alarm _alarm +#define ascftime _ascftime +#define basename _basename +#define brk _brk +#define brkbase _brkbase +#define bsd_signal _bsd_signal +#define catclose _catclose +#define catgets _catgets +#define catopen _catopen +#define cfgetispeed _cfgetispeed +#define cfgetospeed _cfgetospeed +#define cfree _cfree +#define cfsetispeed _cfsetispeed +#define cfsetospeed _cfsetospeed +#define cftime _cftime +#define chdir _chdir +#define chmod _chmod +#define chown _chown +#define chroot _chroot +#define close _close +#define closedir _closedir +#define closelog _closelog +#define countbase _countbase +#define creat _creat +#define crypt _crypt +#define ctermid _ctermid +#define cuserid _cuserid +#define dial _dial +#define dirname _dirname +#define door_bind _door_bind +#define door_call _door_call +#define door_create _door_create +#define door_cred _door_cred +#define door_getparam _door_getparam +#define door_info _door_info +#define door_return _door_return +#define door_revoke _door_revoke +#define door_setparam _door_setparam +#define door_server_create _door_server_create +#define door_ucred _door_ucred +#define door_unbind _door_unbind +#define drand48 _drand48 +#define dup _dup +#define dup2 _dup2 +#define ecvt _ecvt +#define edata _edata +#define encrypt _encrypt +#define end _end +#define endgrent _endgrent +#define endpwent _endpwent +#define endspent _endspent +#define endutent _endutent +#define endutxent _endutxent +#define environ _environ +#define erand48 _erand48 +#define etext _etext +#define execl _execl +#define execle _execle +#define execlp _execlp +#define execv _execv +#define execve _execve +#define execvp _execvp +#define exportfs _exportfs +#define facl _facl +#define fattach _fattach +#define fchdir _fchdir +#define fchmod _fchmod +#define fchown _fchown +#define fchroot _fchroot +#define fcntl _fcntl +#define fcvt _fcvt +#define fdetach _fdetach +#define fdopen _fdopen +#define ffs _ffs +#define fgetgrent _fgetgrent +#define fgetgrent_r _fgetgrent_r +#define fgetpwent _fgetpwent +#define fgetpwent_r _fgetpwent_r +#define fgetspent _fgetspent +#define fgetspent_r _fgetspent_r +#define finite _finite +#define fmtmsg _fmtmsg +#define fork _fork +#define fork1 _fork1 +#define fpathconf _fpathconf +#define fpclass _fpclass +#define fpgetmask _fpgetmask +#define fpgetround _fpgetround +#define fpgetsticky _fpgetsticky +#define fprintf _fprintf +#define fpsetmask _fpsetmask +#define fpsetround _fpsetround +#define fpsetsticky _fpsetsticky +#define fstat _fstat +#define fstatfs _fstatfs +#define fstatvfs _fstatvfs +#define fsync _fsync +/* #define ftell _ftell */ +#define ftello _ftello +/* #define fseek _fseek */ +#define fseeko _fseeko +#define ftok _ftok +#define ftruncate _ftruncate +#define gcvt _gcvt +#define getcontext _getcontext +#define getcwd _getcwd +#define getdate _getdate +#if !defined(_REENTRANT) +#define getdate_err _getdate_err +#else /* defined(_REENTRANT) */ +#define _getdate_err getdate_err +#endif /* !defined(_REENTRANT) */ +#define getdents _getdents +#define getegid _getegid +#define geteuid _geteuid +#define getgid _getgid +#define getgrent _getgrent +#define getgrent_r _getgrent_r +#define getgrgid _getgrgid +#define getgrgid_r _getgrgid_r +#define getgrnam _getgrnam +#define getgrnam_r _getgrnam_r +#define getgroups _getgroups +#define gethz _gethz +#define getitimer _getitimer +#define getlogin _getlogin +#define getmntany _getmntany +#define getmntent _getmntent +#define getmsg _getmsg +#define getopt _getopt +#define getpass _getpass +#define getpassphrase _getpassphrase +#define getpgid _getpgid +#define getpgrp _getpgrp +#define getpid _getpid +#define getpmsg _getpmsg +#define getppid _getppid +#define getpw _getpw +#define getpwent _getpwent +#define getpwent_r _getpwent_r +#define getpwnam _getpwnam +#define getpwnam_r _getpwnam_r +#define getpwuid _getpwuid +#define getpwuid_r _getpwuid_r +#define getrlimit _getrlimit +#define getsid _getsid +#define getspent _getspent +#define getspent_r _getspent_r +#define getspnam _getspnam +#define getspnam_r _getspnam_r +#define getsubopt _getsubopt +#define gettimeofday _gettimeofday +#define gettxt _gettxt +#define getuid _getuid +#define getutent _getutent +#define getutid _getutid +#define getutline _getutline +#define getutmp _getutmp +#define getutmpx _getutmpx +#define getutxent _getutxent +#define getutxid _getutxid +#define getutxline _getutxline +#define getvfsany _getvfsany +#define getvfsent _getvfsent +#define getvfsfile _getvfsfile +#define getvfsspec _getvfsspec +#define getw _getw +#define grantpt _grantpt +#define gsignal _gsignal +#define gtty _gtty +#define hasmntopt _hasmntopt +#define hcreate _hcreate +#define hdestroy _hdestroy +#define hsearch _hsearch +#define id2str _id2str +#define initgroups _initgroups +#define insque _insque +#define install_utrap _install_utrap +#define ioctl _ioctl +#define isastream _isastream +#define isatty _isatty +#define jrand48 _jrand48 +#define kaio _kaio +#define kill _kill +#define l64a _l64a +#define ladd _ladd +#define lchown _lchown +#define lckpwdf _lckpwdf +#define lcong48 _lcong48 +#define ldivide _ldivide +#define lexp10 _lexp10 +#define lfind _lfind +#define link _link +#define llog10 _llog10 +#define llseek _llseek +#define lmul _lmul +#define lockf _lockf +#define longjmp _longjmp +#define lrand48 _lrand48 +#define lsearch _lsearch +#define lseek _lseek +#define lshiftl _lshiftl +#define lsign _lsign +#define lstat _lstat +#define lsub _lsub +#define ltol3 _ltol3 +#define madvise _madvise +#define makecontext _makecontext +#define makeut _makeut +#define makeutx _makeutx +#define memalign _memalign +#define memccpy _memccpy +#define memcntl _memcntl +#define memcmp _memcmp +#define memcpy _memcpy +#define memmove _memmove +#define memset _memset +#define mincore _mincore +#define mkdir _mkdir +#define mkfifo _mkfifo +#define mknod _mknod +#define mktemp _mktemp +#define mkstemp _mkstemp +#define mlock _mlock +#define mlockall _mlockall +#define mmap _mmap +#define modut _modut +#define modutx _modutx +#define monitor _monitor +#define mount _mount +#define mprotect _mprotect +#define mrand48 _mrand48 +#define msgctl _msgctl +#define msgget _msgget +#define msgrcv _msgrcv +#define msgsnd _msgsnd +#define msync _msync +#define munlock _munlock +#define munlockall _munlockall +#define munmap _munmap +#define nfs_getfh _nfs_getfh +#define nfssvc _nfssvc +#define nftw _nftw +#define nice _nice +#define nrand48 _nrand48 +#define nss_delete _nss_delete +#define nss_endent _nss_endent +#define nss_getent _nss_getent +#define nss_search _nss_search +#define nss_setent _nss_setent +#define open _open +#define opendir _opendir +#define openlog _openlog +#define pathconf _pathconf +#define pause _pause +#define pclose _pclose +#define pipe _pipe +#define plock _plock +#define poll _poll +#define popen _popen +#define pread _pread +#define pset_create _pset_create +#define pset_destroy _pset_destroy +#define pset_assign _pset_assign +#define pset_info _pset_info +#define pset_bind _pset_bind +#define profil _profil +#define psiginfo _psiginfo +#define psignal _psignal +#define ptrace _ptrace +#define ptsname _ptsname +#define pwrite _pwrite +#define putenv _putenv +#define putmsg _putmsg +#define putpmsg _putpmsg +#define putpwent _putpwent +#define putspent _putspent +#define pututline _pututline +#define pututxline _pututxline +#define putw _putw +#define read _read +#define readdir _readdir +#define readdir_r _readdir_r +#define readlink _readlink +#define readv _readv +#define realpath _realpath +#define regcmp _regcmp +#define regex _regex +#define remque _remque +#define rmdir _rmdir +#define sbrk _sbrk +#define seed48 _seed48 +#define seekdir _seekdir +#define select _select +#define semctl _semctl +#define semget _semget +#define semop _semop +#define setcontext _setcontext +#define setegid _setegid +#define seteuid _seteuid +#define setgid _setgid +#define setgrent _setgrent +#define setgroups _setgroups +#define setitimer _setitimer +#define setjmp _setjmp +#define setkey _setkey +#define setlocale _setlocale +#define setlogmask _setlogmask +#define setpgid _setpgid +#define setpgrp _setpgrp +#define setpwent _setpwent +#define setregid _setregid +#define setreuid _setreuid +#define setrlimit _setrlimit +#define setsid _setsid +#define setspent _setspent +#define settimeofday _settimeofday +#define setuid _setuid +#define setutent _setutent +#define setutxent _setutxent +#define shmat _shmat +#define shmctl _shmctl +#define shmdt _shmdt +#define shmget _shmget +#define sig2str _sig2str +#define sigaction _sigaction +#define sigaddset _sigaddset +#define sigaltstack _sigaltstack +#define sigdelset _sigdelset +#define sigemptyset _sigemptyset +#define sigfillset _sigfillset +#define sigflag _sigflag +#define sigfpe _sigfpe +#define sighold _sighold +#define sigignore _sigignore +#define siginterrupt _siginterrupt +#define sigismember _sigismember +#define siglongjmp _siglongjmp +#define sigpause _sigpause +#define sigpending _sigpending +#define sigprocmask _sigprocmask +#define sigrelse _sigrelse +#define sigsend _sigsend +#define sigsendset _sigsendset +#define sigset _sigset +#define signal _signal +#define sigsetjmp _sigsetjmp +#define sigsuspend _sigsuspend +#define sigwait _sigwait +#define sleep _sleep +#define srand48 _srand48 +#define ssignal _ssignal +#define stat _stat +#define statfs _statfs +#define statvfs _statvfs +#define stime _stime +#define str2id _str2id +#define str2sig _str2sig +#define strdup _strdup +#define stty _stty +#define swab _swab +#define swapcontext _swapcontext +#define swapctl _swapctl +#define symlink _symlink +#define sync _sync +#define synchutmp _synchutmp +#if defined(__ppc) +#define sysppc _sysppc +#else +#define syssun _syssun +#endif +#define sys_errlist _sys_errlist +#define sys_nerr _sys_nerr +#define syscall _syscall +#define sysconf _sysconf +#define sysfs _sysfs +#define sysinfo _sysinfo +#define syslog _syslog +#define tcdrain _tcdrain +#define tcflow _tcflow +#define tcflush _tcflush +#define tcgetattr _tcgetattr +#define tcgetpgrp _tcgetpgrp +#define tcgetsid _tcgetsid +#define tcsendbreak _tcsendbreak +#define tcsetattr _tcsetattr +#define tcsetpgrp _tcsetpgrp +#define tdelete _tdelete +#define tell _tell +#define telldir _telldir +#define tempnam _tempnam +#define tfind _tfind +#define time _time +#define times _times +#define truncate _truncate +#define tsearch _tsearch +#define ttyname _ttyname +#define ttyslot _ttyslot +#define twalk _twalk +#define tzname _tzname +#define tzset _tzset +#define uadmin _uadmin +#define ulckpwdf _ulckpwdf +#define ulimit _ulimit +#define umask _umask +#define umount _umount +#define uname _uname +#define undial _undial +#define unlink _unlink +#define unlockpt _unlockpt +#define unordered _unordered +#define updutfile _updutfile +#define updutxfile _updutxfile +#define updutmp _updutmp +#define updutmpx _updutmpx +#define updwtmp _updwtmp +#define updwtmpx _updwtmpx +#define ustat _ustat +#define utime _utime +#define utimes _utimes +#define utmpname _utmpname +#define utmpxname _utmpxname +#define utssys _utssys +#define valloc _valloc +#define vfork _vfork +#define vhangup _vhangup +#define vsyslog _vsyslog +#define wait _wait +#define waitid _waitid +#define waitpid _waitpid +#define write _write +#define writev _writev +#define yield _yield +#define _assert __assert +#define _ctype __ctype +#define _filbuf __filbuf +#define _flsbuf __flsbuf +#define _iob __iob + +/* fp and ll functions */ +#define decimal_to_double _decimal_to_double +#define decimal_to_extended _decimal_to_extended +#define decimal_to_quadruple _decimal_to_quadruple +#define decimal_to_single _decimal_to_single +#define double_to_decimal _double_to_decimal +#define econvert _econvert +#define extended_to_decimal _extended_to_decimal +#define fconvert _fconvert +#define file_to_decimal _file_to_decimal +#define func_to_decimal _func_to_decimal +#define gconvert _gconvert +#define qeconvert _qeconvert +#define qecvt _qecvt +#define qfconvert _qfconvert +#define qfcvt _qfcvt +#define qgconvert _qgconvert +#define qgcvt _qgcvt +#define quadruple_to_decimal _quadruple_to_decimal +#define seconvert _seconvert +#define sfconvert _sfconvert +#define sgconvert _sgconvert +#define single_to_decimal _single_to_decimal +#define string_to_decimal _string_to_decimal +#define atoll _atoll +#define llabs _llabs +#define lldiv _lldiv +#define lltostr _lltostr +#define strtoll _strtoll +#define strtoull _strtoull +#define ulltostr _ulltostr + +#if !defined(_LP64) +/* transitional large file interfaces */ +#define creat64 _creat64 +#define ftello64 _ftello64 +#define fseeko64 _fseeko64 +#define fstat64 _fstat64 +#define ftw64 _ftw64 +#define fstatvfs64 _fstatvfs64 +#define ftruncate64 _ftruncate64 +#define getdents64 _getdents64 +#define getrlimit64 _getrlimit64 +#define lockf64 _lockf64 +#define lseek64 _lseek64 +#define lstat64 _lstat64 +#define mkstemp64 _mkstemp64 +#define mmap64 _mmap64 +#define nftw64 _nftw64 +#define open64 _open64 +#define pread64 _pread64 +#define pwrite64 _pwrite64 +#define readdir64 _readdir64 +#define readdir64_r _readdir64_r +#define seekdir64 _seekdir64 +#define telldir64 _telldir64 +#define setrlimit64 _setrlimit64 +#define stat64 _stat64 +#define statvfs64 _statvfs64 +#define truncate64 _truncate64 +#endif /* !_LP64 */ + +#define thr_setspecific _thr_setspecific +#define thr_getspecific _thr_getspecific +#define thr_keycreate _thr_keycreate + +#ifdef SUNW_LIBNSL +#define inet_aton _inet_aton +#endif + +#else /* !defined(__STDC__) */ + +#if !defined(_ASM) +#define const + +#if !defined(_SIZE_T) +#define _SIZE_T +typedef unsigned int size_t; +#endif /* !defined(_SIZE_T) */ +#endif /* !defined(_ASM) */ + +#endif /* defined(__STDC__) */ + +#ifdef __cplusplus +} +#endif + +#endif /* _SYNONYMS_H */ diff --git a/usr/src/lib/libresolv2/include/sys/bitypes.h b/usr/src/lib/libresolv2/include/sys/bitypes.h new file mode 100644 index 0000000000..5228129f3b --- /dev/null +++ b/usr/src/lib/libresolv2/include/sys/bitypes.h @@ -0,0 +1,46 @@ +/* + * Copyright (c) 1997-2000 by Sun Microsystems, Inc. + * All rights reserved. + */ + +/* + * Copyright (c) 1996-1999 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifndef __BIT_TYPES_DEFINED__ +#define __BIT_TYPES_DEFINED__ + + /* + * Basic integral types. Omit the typedef if + * not possible for a machine/compiler combination. + */ +#ifndef _SYS_INT_TYPES_H + typedef /*signed*/ char int8_t; + typedef short int16_t; + typedef int int32_t; +#endif /* _SYS_INT_TYPES_H */ + typedef unsigned char u_int8_t; + typedef unsigned short u_int16_t; + typedef unsigned int u_int32_t; + +# if 0 /* don't fight with these unless you need them */ + typedef long long int64_t; + typedef unsigned long long u_int64_t; +# endif + +#endif /* __BIT_TYPES_DEFINED__ */ diff --git a/usr/src/lib/libresolv2/include/sys/cdefs.h b/usr/src/lib/libresolv2/include/sys/cdefs.h new file mode 100644 index 0000000000..9738c69582 --- /dev/null +++ b/usr/src/lib/libresolv2/include/sys/cdefs.h @@ -0,0 +1,151 @@ +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +/* + * ++Copyright++ 1991, 1993 + * - + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * - + * Portions Copyright (c) 1993 by Digital Equipment Corporation. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies, and that + * the name of Digital Equipment Corporation not be used in advertising or + * publicity pertaining to distribution of the document or software without + * specific, written prior permission. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT + * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * - + * --Copyright-- + */ + +/* + * @(#)cdefs.h 8.1 (Berkeley) 6/2/93 + * $Id: cdefs.h,v 1.1 1996/11/22 02:20:19 vixie Exp $ + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifndef _CDEFS_H_ +#define _CDEFS_H_ + +#if defined(__cplusplus) +#define __BEGIN_DECLS extern "C" { +#define __END_DECLS }; +#else +#define __BEGIN_DECLS +#define __END_DECLS +#endif + +/* + * The __CONCAT macro is used to concatenate parts of symbol names, e.g. + * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo. + * The __CONCAT macro is a bit tricky -- make sure you don't put spaces + * in between its arguments. __CONCAT can also concatenate double-quoted + * strings produced by the __STRING macro, but this only works with ANSI C. + */ +#if defined(__STDC__) || defined(__cplusplus) +#define __P(protos) protos /* full-blown ANSI C */ +#define __CONCAT(x,y) x ## y +#define __STRING(x) #x + +#define __const const /* define reserved names to standard */ +#define __signed signed +#define __volatile volatile +#if defined(__cplusplus) +#define __inline inline /* convert to C++ keyword */ +#else +#ifndef __GNUC__ +#define __inline /* delete GCC keyword */ +#endif /* !__GNUC__ */ +#endif /* !__cplusplus */ + +#else /* !(__STDC__ || __cplusplus) */ +#define __P(protos) () /* traditional C preprocessor */ +#define __CONCAT(x,y) x/**/y +#define __STRING(x) "x" + +#ifndef __GNUC__ +#define __const /* delete pseudo-ANSI C keywords */ +#define __inline +#define __signed +#define __volatile +/* + * In non-ANSI C environments, new programs will want ANSI-only C keywords + * deleted from the program and old programs will want them left alone. + * When using a compiler other than gcc, programs using the ANSI C keywords + * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS. + * When using "gcc -traditional", we assume that this is the intent; if + * __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone. + */ +#ifndef NO_ANSI_KEYWORDS +#define const /* delete ANSI C keywords */ +#define inline +#define signed +#define volatile +#endif +#endif /* !__GNUC__ */ +#endif /* !(__STDC__ || __cplusplus) */ + +/* + * GCC1 and some versions of GCC2 declare dead (non-returning) and + * pure (no side effects) functions using "volatile" and "const"; + * unfortunately, these then cause warnings under "-ansi -pedantic". + * GCC2 uses a new, peculiar __attribute__((attrs)) style. All of + * these work for GNU C++ (modulo a slight glitch in the C++ grammar + * in the distribution version of 2.5.5). + */ +#if !defined(__GNUC__) || __GNUC__ < 2 || __GNUC_MINOR__ < 5 +#define __attribute__(x) /* delete __attribute__ if non-gcc or gcc1 */ +#if defined(__GNUC__) && !defined(__STRICT_ANSI__) +#define __dead __volatile +#define __pure __const +#endif +#endif + +/* Delete pseudo-keywords wherever they are not available or needed. */ +#ifndef __dead +#define __dead +#define __pure +#endif + +#endif /* !_CDEFS_H_ */ |