diff options
author | Jay Freeman <saurik@saurik.com> | 2008-09-14 22:31:23 +0000 |
---|---|---|
committer | Jay Freeman <saurik@saurik.com> | 2008-09-14 22:31:23 +0000 |
commit | b29871e65ba2a741b424bf55dc06101d5fa15bf6 (patch) | |
tree | e22ba5dc85a26b92cfd46f909a0081ff0aad53ae /data/libresolv_ | |
parent | 8170a771cf735b7c4549e1dd464fc62cb8c4822f (diff) |
Removing the obsolete libresolv package.
git-svn-id: http://svn.telesphoreo.org/trunk@473 514c082c-b64e-11dc-b46d-3d985efe055d
Diffstat (limited to 'data/libresolv_')
-rw-r--r-- | data/libresolv_/_metadata/description | 1 | ||||
l--------- | data/libresolv_/_metadata/license | 1 | ||||
l--------- | data/libresolv_/_metadata/maintainer | 1 | ||||
-rw-r--r-- | data/libresolv_/_metadata/priority | 1 | ||||
-rw-r--r-- | data/libresolv_/_metadata/role | 1 | ||||
-rw-r--r-- | data/libresolv_/_metadata/section | 1 | ||||
-rw-r--r-- | data/libresolv_/_metadata/tags | 1 | ||||
-rw-r--r-- | data/libresolv_/_metadata/version | 1 | ||||
-rw-r--r-- | data/libresolv_/dnsinfo_copy.c | 338 | ||||
-rw-r--r-- | data/libresolv_/dnsinfo_private.c | 76 | ||||
-rw-r--r-- | data/libresolv_/dnsinfo_private.h | 193 | ||||
-rw-r--r-- | data/libresolv_/libresolv-25.tar.gz | bin | 0 -> 135079 bytes | |||
-rw-r--r-- | data/libresolv_/make.sh | 9 | ||||
-rw-r--r-- | data/libresolv_/pselect.diff | 22 | ||||
-rw-r--r-- | data/libresolv_/shared_dns_info.h | 180 | ||||
-rw-r--r-- | data/libresolv_/shared_dns_infoUser.c | 524 | ||||
-rw-r--r-- | data/libresolv_/shared_dns_info_types.h | 51 |
17 files changed, 1401 insertions, 0 deletions
diff --git a/data/libresolv_/_metadata/description b/data/libresolv_/_metadata/description new file mode 100644 index 000000000..2183d8cc4 --- /dev/null +++ b/data/libresolv_/_metadata/description @@ -0,0 +1 @@ +Darwin's copy of Bind's resolution engine diff --git a/data/libresolv_/_metadata/license b/data/libresolv_/_metadata/license new file mode 120000 index 000000000..9e5e5e89d --- /dev/null +++ b/data/libresolv_/_metadata/license @@ -0,0 +1 @@ +../../../licenses/apsl-2.0
\ No newline at end of file diff --git a/data/libresolv_/_metadata/maintainer b/data/libresolv_/_metadata/maintainer new file mode 120000 index 000000000..0fa66e077 --- /dev/null +++ b/data/libresolv_/_metadata/maintainer @@ -0,0 +1 @@ +../../../people/saurik
\ No newline at end of file diff --git a/data/libresolv_/_metadata/priority b/data/libresolv_/_metadata/priority new file mode 100644 index 000000000..1c96b78c1 --- /dev/null +++ b/data/libresolv_/_metadata/priority @@ -0,0 +1 @@ ++important diff --git a/data/libresolv_/_metadata/role b/data/libresolv_/_metadata/role new file mode 100644 index 000000000..8d0320866 --- /dev/null +++ b/data/libresolv_/_metadata/role @@ -0,0 +1 @@ +developer diff --git a/data/libresolv_/_metadata/section b/data/libresolv_/_metadata/section new file mode 100644 index 000000000..8708e4b54 --- /dev/null +++ b/data/libresolv_/_metadata/section @@ -0,0 +1 @@ +Networking diff --git a/data/libresolv_/_metadata/tags b/data/libresolv_/_metadata/tags new file mode 100644 index 000000000..a8928cec8 --- /dev/null +++ b/data/libresolv_/_metadata/tags @@ -0,0 +1 @@ +purpose::library diff --git a/data/libresolv_/_metadata/version b/data/libresolv_/_metadata/version new file mode 100644 index 000000000..7273c0fa8 --- /dev/null +++ b/data/libresolv_/_metadata/version @@ -0,0 +1 @@ +25 diff --git a/data/libresolv_/dnsinfo_copy.c b/data/libresolv_/dnsinfo_copy.c new file mode 100644 index 000000000..882b697b9 --- /dev/null +++ b/data/libresolv_/dnsinfo_copy.c @@ -0,0 +1,338 @@ +/* + * Copyright (c) 2004 Apple Computer, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* + * Modification History + * + * March 9, 2004 Allan Nathanson <ajn@apple.com> + * - initial revision + */ + +#include <stdlib.h> +#include <mach/mach.h> +#include <mach/mach_error.h> + +#include "dnsinfo.h" +#include "dnsinfo_private.h" +#include "shared_dns_info.h" + + +static boolean_t +add_list(void **padding, uint32_t *n_padding, int32_t count, int32_t size, void **list) +{ + int32_t need; + + need = count * size; + if (need > *n_padding) { + return FALSE; + } + + *list = (need == 0) ? NULL : *padding; + *padding += need; + *n_padding -= need; + return TRUE; +} + + +static _dns_config_buf_t * +copy_dns_info() +{ + uint8_t *buf = NULL; + dnsDataOut_t dataRef = NULL; + mach_msg_type_number_t dataLen = 0; + mach_port_t server; + kern_return_t status; + + server = _dns_configuration_server_port(); + if (server == MACH_PORT_NULL) { + return NULL; + } + + status = shared_dns_infoGet(server, &dataRef, &dataLen); + (void)mach_port_deallocate(mach_task_self(), server); + if (status != KERN_SUCCESS) { + mach_error("shared_dns_infoGet():", status); + return NULL; + } + + if (dataRef != NULL) { + if (dataLen >= sizeof(_dns_config_buf_t)) { + _dns_config_buf_t *config = (_dns_config_buf_t *)dataRef; + uint32_t len; + uint32_t n_padding = ntohl(config->n_padding); + + len = dataLen + n_padding; + buf = malloc(len); + bcopy((void *)dataRef, buf, dataLen); + bzero(&buf[dataLen], n_padding); + } + + status = vm_deallocate(mach_task_self(), (vm_address_t)dataRef, dataLen); + if (status != KERN_SUCCESS) { + mach_error("vm_deallocate():", status); + free(buf); + return NULL; + } + } + + return (_dns_config_buf_t *)buf; +} + + +static dns_resolver_t * +expand_resolver(_dns_resolver_buf_t *buf, uint32_t n_buf, void **padding, uint32_t *n_padding) +{ + dns_attribute_t *attribute; + uint32_t n_attribute; + int32_t n_nameserver = 0; + int32_t n_search = 0; + int32_t n_sortaddr = 0; + dns_resolver_t *resolver = (dns_resolver_t *)&buf->resolver; + + if (n_buf < sizeof(_dns_resolver_buf_t)) { + goto error; + } + + // initialize domain + + resolver->domain = NULL; + + // initialize nameserver list + + resolver->n_nameserver = ntohl(resolver->n_nameserver); + if (!add_list(padding, + n_padding, + resolver->n_nameserver, + sizeof(struct sockaddr *), + (void **)&resolver->nameserver)) { + goto error; + } + + // initialize port + + resolver->port = ntohs(resolver->port); + + // initialize search list + + resolver->n_search = ntohl(resolver->n_search); + if (!add_list(padding, + n_padding, + resolver->n_search, + sizeof(char *), + (void **)&resolver->search)) { + goto error; + } + + // initialize sortaddr list + + resolver->n_sortaddr = ntohl(resolver->n_sortaddr); + if (!add_list(padding, + n_padding, + resolver->n_sortaddr, + sizeof(dns_sortaddr_t *), + (void **)&resolver->sortaddr)) { + goto error; + } + + // initialize options + + resolver->options = NULL; + + // initialize timeout + + resolver->timeout = ntohl(resolver->timeout); + + // initialize search_order + + resolver->search_order = ntohl(resolver->search_order); + + // process resolver buffer "attribute" data + + n_attribute = n_buf - sizeof(_dns_resolver_buf_t); + attribute = (dns_attribute_t *)&buf->attribute[0]; + if (n_attribute != ntohl(buf->n_attribute)) { + goto error; + } + + while (n_attribute >= sizeof(dns_attribute_t)) { + int32_t attribute_length = ntohl(attribute->length); + + switch (ntohl(attribute->type)) { + case RESOLVER_ATTRIBUTE_DOMAIN : + resolver->domain = (char *)&attribute->attribute[0]; + break; + + case RESOLVER_ATTRIBUTE_ADDRESS : + resolver->nameserver[n_nameserver++] = (struct sockaddr *)&attribute->attribute[0]; + break; + + case RESOLVER_ATTRIBUTE_SEARCH : + resolver->search[n_search++] = (char *)&attribute->attribute[0]; + break; + + case RESOLVER_ATTRIBUTE_SORTADDR : + resolver->sortaddr[n_sortaddr++] = (dns_sortaddr_t *)&attribute->attribute[0]; + break; + + case RESOLVER_ATTRIBUTE_OPTIONS : + resolver->options = (char *)&attribute->attribute[0]; + break; + + default : + break; + } + + attribute = (dns_attribute_t *)((void *)attribute + attribute_length); + n_attribute -= attribute_length; + } + + if ((n_nameserver != resolver->n_nameserver) || + (n_search != resolver->n_search ) || + (n_sortaddr != resolver->n_sortaddr )) { + goto error; + } + + return resolver; + + error : + + return NULL; +} + + +static dns_config_t * +expand_config(_dns_config_buf_t *buf) +{ + dns_attribute_t *attribute; + dns_config_t *config = (dns_config_t *)buf; + uint32_t n_attribute; + uint32_t n_padding; + int32_t n_resolver = 0; + void *padding; + + // establish padding + + padding = &buf->attribute[ntohl(buf->n_attribute)]; + n_padding = ntohl(buf->n_padding); + + // initialize resolver list + + config->n_resolver = ntohl(config->n_resolver); + if (!add_list(&padding, + &n_padding, + config->n_resolver, + sizeof(dns_resolver_t *), + (void **)&config->resolver)) { + goto error; + } + + // process configuration buffer "attribute" data + + n_attribute = ntohl(buf->n_attribute); + attribute = (dns_attribute_t *)&buf->attribute[0]; + + while (n_attribute >= sizeof(dns_attribute_t)) { + int32_t attribute_length = ntohl(attribute->length); + + switch (ntohl(attribute->type)) { + case CONFIG_ATTRIBUTE_RESOLVER : { + dns_resolver_t *resolver; + + // expand resolver buffer + + resolver = expand_resolver((_dns_resolver_buf_t *)&attribute->attribute[0], + attribute_length - sizeof(dns_attribute_t), + &padding, + &n_padding); + if (resolver == NULL) { + goto error; + } + + // add resolver to config list + + config->resolver[n_resolver++] = resolver; + + break; + } + + default : + break; + } + + attribute = (dns_attribute_t *)((void *)attribute + attribute_length); + n_attribute -= attribute_length; + } + + if (n_resolver != config->n_resolver) { + goto error; + } + + return config; + + error : + + return NULL; +} + + +__private_extern__ +const char * +dns_configuration_notify_key() +{ + return _dns_configuration_notify_key(); +} + + +__private_extern__ +dns_config_t * +dns_configuration_copy() +{ + _dns_config_buf_t *buf; + dns_config_t *config; + + buf = copy_dns_info(); + if (buf == NULL) { + return NULL; + } + + config = expand_config(buf); + if (config == NULL) { + free(buf); + return NULL; + } + + return config; +} + + +__private_extern__ +void +dns_configuration_free(dns_config_t *config) +{ + if (config == NULL) { + return; + } + + free((void *)config); + return; +} diff --git a/data/libresolv_/dnsinfo_private.c b/data/libresolv_/dnsinfo_private.c new file mode 100644 index 000000000..96663693a --- /dev/null +++ b/data/libresolv_/dnsinfo_private.c @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2004, 2005 Apple Computer, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +/* + * Modification History + * + * March 9, 2004 Allan Nathanson <ajn@apple.com> + * - initial revision + */ + +#include <stdlib.h> +#include <mach/mach.h> +#include <mach/mach_error.h> +#include <servers/bootstrap.h> + +#include "dnsinfo_private.h" +#include "shared_dns_info_types.h" + + +__private_extern__ +const char * +_dns_configuration_notify_key() +{ + return "com.apple.system.SystemConfiguration.dns_configuration"; +} + + +__private_extern__ +mach_port_t +_dns_configuration_server_port() +{ + mach_port_t server = MACH_PORT_NULL; + char *server_name; + kern_return_t status; + + server_name = getenv("DNS_SERVER"); + if (!server_name) { + server_name = DNS_SERVER; + } + + status = bootstrap_look_up(bootstrap_port, server_name, &server); + switch (status) { + case BOOTSTRAP_SUCCESS : + /* service currently registered, "a good thing" (tm) */ + break; + case BOOTSTRAP_UNKNOWN_SERVICE : + /* service not currently registered, try again later */ + return MACH_PORT_NULL; + default : + mach_error("could not lookup DNS configuration info service:", status); + return MACH_PORT_NULL; + } + + return server; +} + diff --git a/data/libresolv_/dnsinfo_private.h b/data/libresolv_/dnsinfo_private.h new file mode 100644 index 000000000..5e6ac0e5a --- /dev/null +++ b/data/libresolv_/dnsinfo_private.h @@ -0,0 +1,193 @@ +/* + * Copyright (c) 2004, 2005 Apple Computer, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +#ifndef __DNSINFO_PRIVATE_H__ +#define __DNSINFO_PRIVATE_H__ + + +#include <AvailabilityMacros.h> +#include <sys/cdefs.h> +#include <stdint.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <mach/mach.h> + +#include "dnsinfo.h" + +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 + +/* + * What's all of this stuff about??? + * + * In order to minimize the amount of data conversions associated with + * storing, retrieving, and accessing the systems DNS configuration I + * have opted to create a memory image filled with the actual data + * types / structures that would be used by those applications which + * make use of these APIS. The implication here is that we use + * sockaddr's for addresses, char *'s for strings, etc. + * + * To achieve this goal the APIs which are used to store and access the + * configuration data build and use a single buffer of the relevant + * bits. When multiple instances of a given type / structure are needed + * we maintain a count, the actual data, and when the configuration has + * been unpacked, arrays of pointers to the data. + * + * In memory, the data looks as follows: + * + * +-------------------------------------------------------------------+ + * | struct _dns_config_buf_t | + * +-+-------------+---------------------------------------------------+ + * | | config | struct dns_config_t | + * | | +-+--------------+----------------------------------+ + * | | | | n_resolver | int32_t | <- # of name resolvers + * | | | +--------------+----------------------------------+ + * | | | | resolver | dns_resolver_t ** | <- not used during creation, filled + * | | | | | | in with pointer to a list of + * | | | | | | resolver configurations which be + * | | | | | | established in the "padding" + * | | | +--------------+----------------------------------+ + * | | | | ... | ... | + * | +-------------+-+--------------+----------------------------------+ + * | | n_attribute | uint32_t | <- how many bytes of "attribute" + * | | | | data is associated with the + * | | | | configuration + * |-+-------------+---------------------------------------------------+ + * | | n_padding | uint32_t | <- how many additional bytes + * | | | | for arrays (of pointers), ... + * +-+-------------+---------------------------------------------------+ + * | struct dns_attribute_t | + * |-+-------------+---------------------------------------------------+ + * | | type | uint32_t | <- type of attribute (e.g. CONFIG_ATTRIBUTE_RESOLVER) + * | +-------------+---------------------------------------------------+ + * | | length | uint32_t | <- length of the attribute + * | +-------------+---------------------------------------------------+ + * | | attribute | struct _dns_resolver_buf_t | <- the attribute data (resolver configuration #1) + * | | +-+-------------+-----------------------------------+ + * | | | | resolver | struct dns_resolver_t | + * | | | | +--------------+--------------------+ + * | | | | | domain | char * | <- not used during creation, + * | | | | | | | filled in with pointer to + * | | | | | | | domain name in the "padding" + * | | | | +--------------+--------------------+ + * | | | | | n_nameserver | int32_t | <- # of name server addresses + * | | | | +--------------+--------------------+ + * | | | | | nameserver | struct sockaddr ** | <- not used during creation, + * | | | | | | | filled in with pointer to + * | | | | | | | a list of addresses which + * | | | | | | | will be established in the + * | | | | | | | "padding" + * | | | | +--------------+--------------------+ + * | | | | | ... | + * | | +-+-------------+--------------+--------------------+ + * | | | | n_attribute | uint32_t | + * | | +-+-------------+-----------------------------------+ + * | | | | attribute | struct dns_attribute_t | + * | | | | +-+-----------+---------------------+ + * | | | | | | type | uint32_t | <- type of attribute (e.g. RESOLVER_ATTRIBUTE_DOMAIN) + * | | | | | +-----------+---------------------+ + * | | | | | | length | uint32_t | <- length of the attribute + * | | | | | +-----------+---------------------+ + * | | | | | | attribute | | <- the attribute data ("apple.com") + * | | +-+-------------+-------------+---------------------+ + * | | | | attribute | struct dns_attribute_t | + * | | | | +-+-----------+---------------------+ + * | | | | | | type | uint32_t | <- type of attribute (e.g. RESOLVER_ATTRIBUTE_ADDRESS) + * | | | | | +-----------+---------------------+ + * | | | | | | length | uint32_t | <- length of the attribute + * | | | | | +-----------+---------------------+ + * | | | | | | attribute | | <- the attribute data ("struct sockaddr_in" #1) + * | | +---------------+-----------------------------------+ + * | | | | attribute | struct dns_attribute_t | + * | | | | +-+-----------+---------------------+ + * | | | | | | type | uint32_t | <- type of attribute (e.g. RESOLVER_ATTRIBUTE_ADDRESS) + * | | | | | +-----------+---------------------+ + * | | | | | | length | uint32_t | <- length of the attribute + * | | | | | +-----------+---------------------+ + * | | | | | | attribute | | <- the attribute data ("struct sockaddr_in" #2) + * | | +---------------+-----------------------------------+ + * | | | ... | + * +-+-------------+---------------------------------------------------+ + * | | attribute | struct _dns_resolver_buf_t | <- the attribute data (resolver configuration #2) + * | | +---------------+-----------------------------------+ + * | | | ... | + * +---------------+---------------------------------------------------+ + * | | ... | + * +---------------+---------------------------------------------------+ + * + * When the data is unpacked the "n_padding" additional bytes + * specified in configuration buffer will be allocated at the + * end of this buffer. Arrays of pointers will be allocated + * within the extra space array element (an "attribute") is + * encountered the pointer reference will be filled in. + */ + + +// configuration buffer attributes +enum { + CONFIG_ATTRIBUTE_RESOLVER = 1 +}; + + +// resolver buffer attributes +enum { + RESOLVER_ATTRIBUTE_DOMAIN = 10, + RESOLVER_ATTRIBUTE_ADDRESS, + RESOLVER_ATTRIBUTE_SEARCH, + RESOLVER_ATTRIBUTE_SORTADDR, + RESOLVER_ATTRIBUTE_OPTIONS +}; + + +typedef struct { + uint32_t type; + uint32_t length; + uint8_t attribute[0]; +} dns_attribute_t; + + +typedef struct { + dns_config_t config; + uint32_t n_attribute; + uint32_t n_padding; + uint8_t attribute[0]; +} _dns_config_buf_t; + + +typedef struct { + dns_resolver_t resolver; + uint32_t n_attribute; + uint8_t attribute[0]; +} _dns_resolver_buf_t; + + +__BEGIN_DECLS + +const char * _dns_configuration_notify_key() AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; +mach_port_t _dns_configuration_server_port() AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; + +__END_DECLS + +#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 */ + +#endif /* __DNSINFO_PRIVATE_H__ */ diff --git a/data/libresolv_/libresolv-25.tar.gz b/data/libresolv_/libresolv-25.tar.gz Binary files differnew file mode 100644 index 000000000..eac1867b6 --- /dev/null +++ b/data/libresolv_/libresolv-25.tar.gz diff --git a/data/libresolv_/make.sh b/data/libresolv_/make.sh new file mode 100644 index 000000000..26b76422c --- /dev/null +++ b/data/libresolv_/make.sh @@ -0,0 +1,9 @@ +pkg:setup +cp -a "${PKG_DATA}"/*.[ch] . +declare -a flags +# XXX: don't use this on darwin8 +flags[${#flags[@]}]=-DNEED_PSELECT +"${PKG_TARG}-gcc" -fno-common !(dns_async).c -o libresolv.9.dylib -dynamiclib -I. -linfo -install_name /usr/lib/libresolv.9.dylib -compatibility_version 1.0.0 "${flags[@]}" -save-temps +pkg: mkdir -p /usr/lib +pkg: cp -a libresolv.9.dylib /usr/lib +pkg: ln -s libresolv.9.dylib /usr/lib/libresolv.dylib diff --git a/data/libresolv_/pselect.diff b/data/libresolv_/pselect.diff new file mode 100644 index 000000000..192eee992 --- /dev/null +++ b/data/libresolv_/pselect.diff @@ -0,0 +1,22 @@ +diff -ru libresolv-19/res_send.c libresolv-19+iPhone/res_send.c +--- libresolv-19/res_send.c 2007-10-05 00:02:17.000000000 +0000 ++++ libresolv-19+iPhone/res_send.c 2008-04-04 20:18:45.000000000 +0000 +@@ -141,7 +141,8 @@ + static void Perror(const res_state, FILE *, const char *, int); + static int sock_eq(struct sockaddr *, struct sockaddr *); + #ifdef NEED_PSELECT +-static int pselect(int, void *, void *, void *, struct timespec *, const sigset_t *); ++static int pselect_(int, void *, void *, void *, struct timespec *, const sigset_t *); ++#define pselect pselect_ + #endif + + static const int niflags = NI_NUMERICHOST | NI_NUMERICSERV; +@@ -1414,7 +1415,7 @@ + #ifdef NEED_PSELECT + /* XXX needs to move to the porting library. */ + static int +-pselect(int nfds, void *rfds, void *wfds, void *efds, struct timespec *tsp, const sigset_t *sigmask) ++pselect_(int nfds, void *rfds, void *wfds, void *efds, struct timespec *tsp, const sigset_t *sigmask) + { + struct timeval tv, *tvp = NULL; + sigset_t sigs; diff --git a/data/libresolv_/shared_dns_info.h b/data/libresolv_/shared_dns_info.h new file mode 100644 index 000000000..c03837252 --- /dev/null +++ b/data/libresolv_/shared_dns_info.h @@ -0,0 +1,180 @@ +#ifndef _shared_dns_info_user_ +#define _shared_dns_info_user_ + +/* Module shared_dns_info */ + +#include <string.h> +#include <mach/ndr.h> +#include <mach/boolean.h> +#include <mach/kern_return.h> +#include <mach/notify.h> +#include <mach/mach_types.h> +#include <mach/message.h> +#include <mach/mig_errors.h> +#include <mach/port.h> + +#ifdef AUTOTEST +#ifndef FUNCTION_PTR_T +#define FUNCTION_PTR_T +typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t); +typedef struct { + char *name; + function_ptr_t function; +} function_table_entry; +typedef function_table_entry *function_table_t; +#endif /* FUNCTION_PTR_T */ +#endif /* AUTOTEST */ + +#ifndef shared_dns_info_MSG_COUNT +#define shared_dns_info_MSG_COUNT 2 +#endif /* shared_dns_info_MSG_COUNT */ + +#include <mach/std_types.h> +#include <mach/mig.h> +#include <mach/mig.h> +#include <mach/mach_types.h> +#include "shared_dns_info_types.h" + +#ifdef __BeforeMigUserHeader +__BeforeMigUserHeader +#endif /* __BeforeMigUserHeader */ + +#include <sys/cdefs.h> +__BEGIN_DECLS + + +/* Routine shared_dns_infoGet */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t shared_dns_infoGet +( + mach_port_t server, + dnsDataOut_t *data, + mach_msg_type_number_t *dataCnt +); + +/* Routine shared_dns_infoSet */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t shared_dns_infoSet +( + mach_port_t server, + dnsData_t data, + mach_msg_type_number_t dataCnt +); + +__END_DECLS + +/********************** Caution **************************/ +/* The following data types should be used to calculate */ +/* maximum message sizes only. The actual message may be */ +/* smaller, and the position of the arguments within the */ +/* message layout may vary from what is presented here. */ +/* For example, if any of the arguments are variable- */ +/* sized, and less than the maximum is sent, the data */ +/* will be packed tight in the actual message to reduce */ +/* the presence of holes. */ +/********************** Caution **************************/ + +/* typedefs for all requests */ + +#ifndef __Request__shared_dns_info_subsystem__defined +#define __Request__shared_dns_info_subsystem__defined + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + } __Request__shared_dns_infoGet_t; +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t data; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t dataCnt; + } __Request__shared_dns_infoSet_t; +#ifdef __MigPackStructs +#pragma pack() +#endif +#endif /* !__Request__shared_dns_info_subsystem__defined */ + +/* union of all requests */ + +#ifndef __RequestUnion__shared_dns_info_subsystem__defined +#define __RequestUnion__shared_dns_info_subsystem__defined +union __RequestUnion__shared_dns_info_subsystem { + __Request__shared_dns_infoGet_t Request_shared_dns_infoGet; + __Request__shared_dns_infoSet_t Request_shared_dns_infoSet; +}; +#endif /* !__RequestUnion__shared_dns_info_subsystem__defined */ +/* typedefs for all replies */ + +#ifndef __Reply__shared_dns_info_subsystem__defined +#define __Reply__shared_dns_info_subsystem__defined + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t data; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t dataCnt; + } __Reply__shared_dns_infoGet_t; +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + } __Reply__shared_dns_infoSet_t; +#ifdef __MigPackStructs +#pragma pack() +#endif +#endif /* !__Reply__shared_dns_info_subsystem__defined */ + +/* union of all replies */ + +#ifndef __ReplyUnion__shared_dns_info_subsystem__defined +#define __ReplyUnion__shared_dns_info_subsystem__defined +union __ReplyUnion__shared_dns_info_subsystem { + __Reply__shared_dns_infoGet_t Reply_shared_dns_infoGet; + __Reply__shared_dns_infoSet_t Reply_shared_dns_infoSet; +}; +#endif /* !__RequestUnion__shared_dns_info_subsystem__defined */ + +#ifndef subsystem_to_name_map_shared_dns_info +#define subsystem_to_name_map_shared_dns_info \ + { "shared_dns_infoGet", 21000 },\ + { "shared_dns_infoSet", 21001 } +#endif + +#ifdef __AfterMigUserHeader +__AfterMigUserHeader +#endif /* __AfterMigUserHeader */ + +#endif /* _shared_dns_info_user_ */ diff --git a/data/libresolv_/shared_dns_infoUser.c b/data/libresolv_/shared_dns_infoUser.c new file mode 100644 index 000000000..64a7f16ce --- /dev/null +++ b/data/libresolv_/shared_dns_infoUser.c @@ -0,0 +1,524 @@ +/* + * IDENTIFICATION: + * stub generated Tue Jan 1 16:42:09 2008 + * with a MiG generated Mon Sep 11 19:11:05 PDT 2006 by root@b09.apple.com + * OPTIONS: + */ +#define __MIG_check__Reply__shared_dns_info_subsystem__ 1 +#define __NDR_convert__Reply__shared_dns_info_subsystem__ 1 +#define __NDR_convert__mig_reply_error_subsystem__ 1 + +#include "shared_dns_info.h" + + +#ifndef mig_internal +#define mig_internal static __inline__ +#endif /* mig_internal */ + +#ifndef mig_external +#define mig_external +#endif /* mig_external */ + +#if !defined(__MigTypeCheck) && defined(TypeCheck) +#define __MigTypeCheck TypeCheck /* Legacy setting */ +#endif /* !defined(__MigTypeCheck) */ + +#if !defined(__MigKernelSpecificCode) && defined(_MIG_KERNEL_SPECIFIC_CODE_) +#define __MigKernelSpecificCode _MIG_KERNEL_SPECIFIC_CODE_ /* Legacy setting */ +#endif /* !defined(__MigKernelSpecificCode) */ + +#ifndef LimitCheck +#define LimitCheck 0 +#endif /* LimitCheck */ + +#ifndef min +#define min(a,b) ( ((a) < (b))? (a): (b) ) +#endif /* min */ + +#if !defined(_WALIGN_) +#define _WALIGN_(x) (((x) + 3) & ~3) +#endif /* !defined(_WALIGN_) */ + +#if !defined(_WALIGNSZ_) +#define _WALIGNSZ_(x) _WALIGN_(sizeof(x)) +#endif /* !defined(_WALIGNSZ_) */ + +#ifndef UseStaticTemplates +#define UseStaticTemplates 0 +#endif /* UseStaticTemplates */ + +#ifndef __MachMsgErrorWithTimeout +#define __MachMsgErrorWithTimeout(_R_) { \ + switch (_R_) { \ + case MACH_SEND_INVALID_REPLY: \ + case MACH_RCV_INVALID_NAME: \ + case MACH_RCV_PORT_DIED: \ + case MACH_RCV_PORT_CHANGED: \ + case MACH_RCV_TIMED_OUT: \ + mig_dealloc_reply_port(InP->Head.msgh_reply_port); \ + break; \ + default: \ + mig_put_reply_port(InP->Head.msgh_reply_port); \ + } \ +} +#endif /* __MachMsgErrorWithTimeout */ + +#ifndef __MachMsgErrorWithoutTimeout +#define __MachMsgErrorWithoutTimeout(_R_) { \ + switch (_R_) { \ + case MACH_SEND_INVALID_REPLY: \ + case MACH_RCV_INVALID_NAME: \ + case MACH_RCV_PORT_DIED: \ + case MACH_RCV_PORT_CHANGED: \ + mig_dealloc_reply_port(InP->Head.msgh_reply_port); \ + break; \ + default: \ + mig_put_reply_port(InP->Head.msgh_reply_port); \ + } \ +} +#endif /* __MachMsgErrorWithoutTimeout */ + +#ifndef __DeclareSendRpc +#define __DeclareSendRpc(_NUM_, _NAME_) +#endif /* __DeclareSendRpc */ + +#ifndef __BeforeSendRpc +#define __BeforeSendRpc(_NUM_, _NAME_) +#endif /* __BeforeSendRpc */ + +#ifndef __AfterSendRpc +#define __AfterSendRpc(_NUM_, _NAME_) +#endif /* __AfterSendRpc */ + +#ifndef __DeclareSendSimple +#define __DeclareSendSimple(_NUM_, _NAME_) +#endif /* __DeclareSendSimple */ + +#ifndef __BeforeSendSimple +#define __BeforeSendSimple(_NUM_, _NAME_) +#endif /* __BeforeSendSimple */ + +#ifndef __AfterSendSimple +#define __AfterSendSimple(_NUM_, _NAME_) +#endif /* __AfterSendSimple */ + +#define msgh_request_port msgh_remote_port +#define msgh_reply_port msgh_local_port + + + +#if ( __MigTypeCheck || __NDR_convert__ ) +#if __MIG_check__Reply__shared_dns_info_subsystem__ +#if !defined(__MIG_check__Reply__shared_dns_infoGet_t__defined) +#define __MIG_check__Reply__shared_dns_infoGet_t__defined +#ifndef __NDR_convert__int_rep__Reply__shared_dns_infoGet_t__data__defined +#if defined(__NDR_convert__int_rep__shared_dns_info__dnsDataOut_t__defined) +#define __NDR_convert__int_rep__Reply__shared_dns_infoGet_t__data__defined +#define __NDR_convert__int_rep__Reply__shared_dns_infoGet_t__data(a, f, c) \ + __NDR_convert__int_rep__shared_dns_info__dnsDataOut_t((dnsDataOut_t *)(a), f, c) +#elif defined(__NDR_convert__int_rep__dnsDataOut_t__defined) +#define __NDR_convert__int_rep__Reply__shared_dns_infoGet_t__data__defined +#define __NDR_convert__int_rep__Reply__shared_dns_infoGet_t__data(a, f, c) \ + __NDR_convert__int_rep__dnsDataOut_t((dnsDataOut_t *)(a), f, c) +#endif /* defined(__NDR_convert__*__defined) */ +#endif /* __NDR_convert__int_rep__Reply__shared_dns_infoGet_t__data__defined */ + + +#ifndef __NDR_convert__int_rep__Reply__shared_dns_infoGet_t__dataCnt__defined +#if defined(__NDR_convert__int_rep__shared_dns_info__mach_msg_type_number_t__defined) +#define __NDR_convert__int_rep__Reply__shared_dns_infoGet_t__dataCnt__defined +#define __NDR_convert__int_rep__Reply__shared_dns_infoGet_t__dataCnt(a, f) \ + __NDR_convert__int_rep__shared_dns_info__mach_msg_type_number_t((mach_msg_type_number_t *)(a), f) +#elif defined(__NDR_convert__int_rep__mach_msg_type_number_t__defined) +#define __NDR_convert__int_rep__Reply__shared_dns_infoGet_t__dataCnt__defined +#define __NDR_convert__int_rep__Reply__shared_dns_infoGet_t__dataCnt(a, f) \ + __NDR_convert__int_rep__mach_msg_type_number_t((mach_msg_type_number_t *)(a), f) +#endif /* defined(__NDR_convert__*__defined) */ +#endif /* __NDR_convert__int_rep__Reply__shared_dns_infoGet_t__dataCnt__defined */ + + +#ifndef __NDR_convert__char_rep__Reply__shared_dns_infoGet_t__data__defined +#if defined(__NDR_convert__char_rep__shared_dns_info__dnsDataOut_t__defined) +#define __NDR_convert__char_rep__Reply__shared_dns_infoGet_t__data__defined +#define __NDR_convert__char_rep__Reply__shared_dns_infoGet_t__data(a, f, c) \ + __NDR_convert__char_rep__shared_dns_info__dnsDataOut_t((dnsDataOut_t *)(a), f, c) +#elif defined(__NDR_convert__char_rep__dnsDataOut_t__defined) +#define __NDR_convert__char_rep__Reply__shared_dns_infoGet_t__data__defined +#define __NDR_convert__char_rep__Reply__shared_dns_infoGet_t__data(a, f, c) \ + __NDR_convert__char_rep__dnsDataOut_t((dnsDataOut_t *)(a), f, c) +#endif /* defined(__NDR_convert__*__defined) */ +#endif /* __NDR_convert__char_rep__Reply__shared_dns_infoGet_t__data__defined */ + + + +#ifndef __NDR_convert__float_rep__Reply__shared_dns_infoGet_t__data__defined +#if defined(__NDR_convert__float_rep__shared_dns_info__dnsDataOut_t__defined) +#define __NDR_convert__float_rep__Reply__shared_dns_infoGet_t__data__defined +#define __NDR_convert__float_rep__Reply__shared_dns_infoGet_t__data(a, f, c) \ + __NDR_convert__float_rep__shared_dns_info__dnsDataOut_t((dnsDataOut_t *)(a), f, c) +#elif defined(__NDR_convert__float_rep__dnsDataOut_t__defined) +#define __NDR_convert__float_rep__Reply__shared_dns_infoGet_t__data__defined +#define __NDR_convert__float_rep__Reply__shared_dns_infoGet_t__data(a, f, c) \ + __NDR_convert__float_rep__dnsDataOut_t((dnsDataOut_t *)(a), f, c) +#endif /* defined(__NDR_convert__*__defined) */ +#endif /* __NDR_convert__float_rep__Reply__shared_dns_infoGet_t__data__defined */ + + + + +mig_internal kern_return_t __MIG_check__Reply__shared_dns_infoGet_t(__Reply__shared_dns_infoGet_t *Out0P) +{ + + typedef __Reply__shared_dns_infoGet_t __Reply; + boolean_t msgh_simple; +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 21100) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + + msgh_simple = !(Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX); +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((msgh_simple || Out0P->msgh_body.msgh_descriptor_count != 1 || + msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (!msgh_simple || msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + ((mig_reply_error_t *)Out0P)->RetCode == KERN_SUCCESS)) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (msgh_simple) { +#ifdef __NDR_convert__mig_reply_error_t__defined + __NDR_convert__mig_reply_error_t((mig_reply_error_t *)Out0P); +#endif /* __NDR_convert__mig_reply_error_t__defined */ + return ((mig_reply_error_t *)Out0P)->RetCode; + } + +#if __MigTypeCheck + if (Out0P->data.type != MACH_MSG_OOL_DESCRIPTOR) + { return MIG_TYPE_ERROR; } +#endif /* __MigTypeCheck */ + +#if defined(__NDR_convert__int_rep__Reply__shared_dns_infoGet_t__data__defined) || \ + defined(__NDR_convert__int_rep__Reply__shared_dns_infoGet_t__dataCnt__defined) + if (Out0P->NDR.int_rep != NDR_record.int_rep) { +#if defined(__NDR_convert__int_rep__Reply__shared_dns_infoGet_t__dataCnt__defined) + __NDR_convert__int_rep__Reply__shared_dns_infoGet_t__dataCnt(&Out0P->dataCnt, Out0P->NDR.int_rep); +#endif /* __NDR_convert__int_rep__Reply__shared_dns_infoGet_t__dataCnt__defined */ +#if defined(__NDR_convert__int_rep__Reply__shared_dns_infoGet_t__data__defined) + __NDR_convert__int_rep__Reply__shared_dns_infoGet_t__data((dnsDataOut_t)(Out0P->data.address), Out0P->NDR.int_rep, Out0P->dataCnt); +#endif /* __NDR_convert__int_rep__Reply__shared_dns_infoGet_t__data__defined */ + } +#endif /* defined(__NDR_convert__int_rep...) */ + +#if defined(__NDR_convert__char_rep__Reply__shared_dns_infoGet_t__data__defined) || \ + 0 + if (Out0P->NDR.char_rep != NDR_record.char_rep) { +#if defined(__NDR_convert__char_rep__Reply__shared_dns_infoGet_t__data__defined) + __NDR_convert__char_rep__Reply__shared_dns_infoGet_t__data((dnsDataOut_t)(Out0P->data.address), Out0P->NDR.char_rep, Out0P->dataCnt); +#endif /* __NDR_convert__char_rep__Reply__shared_dns_infoGet_t__data__defined */ + } +#endif /* defined(__NDR_convert__char_rep...) */ + +#if defined(__NDR_convert__float_rep__Reply__shared_dns_infoGet_t__data__defined) || \ + 0 + if (Out0P->NDR.float_rep != NDR_record.float_rep) { +#if defined(__NDR_convert__float_rep__Reply__shared_dns_infoGet_t__data__defined) + __NDR_convert__float_rep__Reply__shared_dns_infoGet_t__data((dnsDataOut_t)(Out0P->data.address), Out0P->NDR.float_rep, Out0P->dataCnt); +#endif /* __NDR_convert__float_rep__Reply__shared_dns_infoGet_t__data__defined */ + } +#endif /* defined(__NDR_convert__float_rep...) */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__shared_dns_infoGet_t__defined) */ +#endif /* __MIG_check__Reply__shared_dns_info_subsystem__ */ +#endif /* ( __MigTypeCheck || __NDR_convert__ ) */ + + +/* Routine shared_dns_infoGet */ +mig_external kern_return_t shared_dns_infoGet +( + mach_port_t server, + dnsDataOut_t *data, + mach_msg_type_number_t *dataCnt +) +{ + { + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + } Request; +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t data; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t dataCnt; + mach_msg_trailer_t trailer; + } Reply; +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t data; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t dataCnt; + } __Reply; +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + +#ifdef __MIG_check__Reply__shared_dns_infoGet_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__shared_dns_infoGet_t__defined */ + + __DeclareSendRpc(21000, "shared_dns_infoGet") + + InP->Head.msgh_bits = + MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = server; + InP->Head.msgh_reply_port = mig_get_reply_port(); + InP->Head.msgh_id = 21000; + + __BeforeSendRpc(21000, "shared_dns_infoGet") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(21000, "shared_dns_infoGet") + if (msg_result != MACH_MSG_SUCCESS) { + __MachMsgErrorWithoutTimeout(msg_result); + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__shared_dns_infoGet_t__defined) + check_result = __MIG_check__Reply__shared_dns_infoGet_t((__Reply__shared_dns_infoGet_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__shared_dns_infoGet_t__defined) */ + + *data = (dnsDataOut_t)(Out0P->data.address); + *dataCnt = Out0P->dataCnt; + + return KERN_SUCCESS; + } +} + +#if ( __MigTypeCheck || __NDR_convert__ ) +#if __MIG_check__Reply__shared_dns_info_subsystem__ +#if !defined(__MIG_check__Reply__shared_dns_infoSet_t__defined) +#define __MIG_check__Reply__shared_dns_infoSet_t__defined +#ifndef __NDR_convert__int_rep__Reply__shared_dns_infoSet_t__RetCode__defined +#if defined(__NDR_convert__int_rep__shared_dns_info__kern_return_t__defined) +#define __NDR_convert__int_rep__Reply__shared_dns_infoSet_t__RetCode__defined +#define __NDR_convert__int_rep__Reply__shared_dns_infoSet_t__RetCode(a, f) \ + __NDR_convert__int_rep__shared_dns_info__kern_return_t((kern_return_t *)(a), f) +#elif defined(__NDR_convert__int_rep__kern_return_t__defined) +#define __NDR_convert__int_rep__Reply__shared_dns_infoSet_t__RetCode__defined +#define __NDR_convert__int_rep__Reply__shared_dns_infoSet_t__RetCode(a, f) \ + __NDR_convert__int_rep__kern_return_t((kern_return_t *)(a), f) +#endif /* defined(__NDR_convert__*__defined) */ +#endif /* __NDR_convert__int_rep__Reply__shared_dns_infoSet_t__RetCode__defined */ + + + + + +mig_internal kern_return_t __MIG_check__Reply__shared_dns_infoSet_t(__Reply__shared_dns_infoSet_t *Out0P) +{ + + typedef __Reply__shared_dns_infoSet_t __Reply; + if (Out0P->Head.msgh_id != 21101) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + (Out0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Reply))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + +#if defined(__NDR_convert__int_rep__Reply__shared_dns_infoSet_t__RetCode__defined) + if (Out0P->NDR.int_rep != NDR_record.int_rep) + __NDR_convert__int_rep__Reply__shared_dns_infoSet_t__RetCode(&Out0P->RetCode, Out0P->NDR.int_rep); +#endif /* __NDR_convert__int_rep__Reply__shared_dns_infoSet_t__RetCode__defined */ + { return Out0P->RetCode; + } +} +#endif /* !defined(__MIG_check__Reply__shared_dns_infoSet_t__defined) */ +#endif /* __MIG_check__Reply__shared_dns_info_subsystem__ */ +#endif /* ( __MigTypeCheck || __NDR_convert__ ) */ + + +/* Routine shared_dns_infoSet */ +mig_external kern_return_t shared_dns_infoSet +( + mach_port_t server, + dnsData_t data, + mach_msg_type_number_t dataCnt +) +{ + { + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t data; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t dataCnt; + } Request; +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + mach_msg_trailer_t trailer; + } Reply; +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + } __Reply; +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + +#ifdef __MIG_check__Reply__shared_dns_infoSet_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__shared_dns_infoSet_t__defined */ + + __DeclareSendRpc(21001, "shared_dns_infoSet") + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t dataTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 1; +#if UseStaticTemplates + InP->data = dataTemplate; + InP->data.address = (void *)(data); + InP->data.size = dataCnt; +#else /* UseStaticTemplates */ + InP->data.address = (void *)(data); + InP->data.size = dataCnt; + InP->data.deallocate = FALSE; + InP->data.copy = MACH_MSG_VIRTUAL_COPY; + InP->data.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->NDR = NDR_record; + + InP->dataCnt = dataCnt; + + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = server; + InP->Head.msgh_reply_port = mig_get_reply_port(); + InP->Head.msgh_id = 21001; + + __BeforeSendRpc(21001, "shared_dns_infoSet") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(21001, "shared_dns_infoSet") + if (msg_result != MACH_MSG_SUCCESS) { + __MachMsgErrorWithoutTimeout(msg_result); + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__shared_dns_infoSet_t__defined) + check_result = __MIG_check__Reply__shared_dns_infoSet_t((__Reply__shared_dns_infoSet_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__shared_dns_infoSet_t__defined) */ + + return KERN_SUCCESS; + } +} diff --git a/data/libresolv_/shared_dns_info_types.h b/data/libresolv_/shared_dns_info_types.h new file mode 100644 index 000000000..e4fe4b679 --- /dev/null +++ b/data/libresolv_/shared_dns_info_types.h @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2004 Apple Computer, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +#ifndef _SHARED_DNS_INFO_TYPES_H +#define _SHARED_DNS_INFO_TYPES_H + +/* + * Keep IPC functions private to the framework + */ +#ifdef mig_external +#undef mig_external +#endif +#define mig_external __private_extern__ + +/* + * Mach server port name + */ +#define DNS_SERVER "com.apple.SystemConfiguration.configd" + +/* + * Input arguments: DNS configuration + * (sent as out-of-line data in a message) + */ +typedef const char * dnsData_t; + +/* Output arguments: DNS configuration + * (sent as out-of-line data in a message) + */ +typedef char * dnsDataOut_t; + +#endif /* !_SHARED_DNS_INFO_TYPES_H */ |