1/*
2 * Copyright (c) 2012, 2013 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24#ifndef _LIBSYSTEMCONFIGURATION_CLIENT_H
25#define _LIBSYSTEMCONFIGURATION_CLIENT_H
26
27#include <Availability.h>
28#include <TargetConditionals.h>
29#include <sys/cdefs.h>
30#include <dispatch/dispatch.h>
31#include <xpc/xpc.h>
32
33// ------------------------------------------------------------
34
35#pragma mark -
36#pragma mark [XPC] DNS configuration server
37
38#define	DNSINFO_SERVER_VERSION		20130408
39
40#if	!TARGET_IPHONE_SIMULATOR
41#define	DNSINFO_SERVICE_NAME		"com.apple.SystemConfiguration.DNSConfiguration"
42#else	// !TARGET_IPHONE_SIMULATOR
43#define	DNSINFO_SERVICE_NAME		"com.apple.SystemConfiguration.DNSConfiguration_sim"
44#endif	// !TARGET_IPHONE_SIMULATOR
45
46#define	DNSINFO_PROC_NAME		"proc_name"	// string
47
48#define	DNSINFO_REQUEST			"request_op"	// int64
49
50enum {
51	DNSINFO_REQUEST_COPY		= 0x10001,
52	DNSINFO_REQUEST_ACKNOWLEDGE,
53};
54
55#define	DNSINFO_CONFIGURATION		"configuration"	// data
56#define	DNSINFO_GENERATION		"generation"	// uint64
57
58// ------------------------------------------------------------
59
60#pragma mark -
61#pragma mark [XPC] Network information (nwi) server
62
63#define	NWI_SERVER_VERSION		20130408
64
65#if	!TARGET_IPHONE_SIMULATOR
66#define	NWI_SERVICE_NAME		"com.apple.SystemConfiguration.NetworkInformation"
67#else	// !TARGET_IPHONE_SIMULATOR
68#define	NWI_SERVICE_NAME		"com.apple.SystemConfiguration.NetworkInformation_sim"
69#endif	// !TARGET_IPHONE_SIMULATOR
70
71#define	NWI_PROC_NAME			"proc_name"	// string
72
73#define	NWI_REQUEST			"request_op"	// int64
74
75enum {
76	NWI_REQUEST_COPY		= 0x20001,
77	NWI_REQUEST_ACKNOWLEDGE,
78};
79
80#define	NWI_CONFIGURATION		"configuration"	// data
81#define	NWI_GENERATION			"generation"	// uint64
82
83// ------------------------------------------------------------
84
85typedef struct {
86	_Bool			active;
87	xpc_connection_t	connection;
88	char			*service_description;
89	char			*service_name;
90} libSC_info_client_t;
91
92// ------------------------------------------------------------
93
94__BEGIN_DECLS
95
96libSC_info_client_t *
97libSC_info_client_create		(
98					 dispatch_queue_t	q,
99					 const char		*service_name,
100					 const char		*service_description
101					);
102
103void
104libSC_info_client_release		(
105					 libSC_info_client_t	*client
106					);
107
108xpc_object_t
109libSC_send_message_with_reply_sync	(
110					 libSC_info_client_t	*client,
111					 xpc_object_t		message
112					);
113
114__END_DECLS
115
116#endif // _LIBSYSTEMCONFIGURATION_CLIENT_H
117