]> git.saurik.com Git - apple/configd.git/blob - libSystemConfiguration/libSystemConfiguration_client.h
configd-1061.141.1.tar.gz
[apple/configd.git] / libSystemConfiguration / libSystemConfiguration_client.h
1 /*
2 * Copyright (c) 2012, 2013, 2015-2018 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 <os/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_OS_SIMULATOR || TARGET_OS_IOSMAC
41 #define DNSINFO_SERVICE_NAME "com.apple.SystemConfiguration.DNSConfiguration"
42 #else // !TARGET_OS_SIMULATOR || TARGET_OS_IOSMAC
43 #define DNSINFO_SERVICE_NAME "com.apple.SystemConfiguration.DNSConfiguration_sim"
44 #endif // !TARGET_OS_SIMULATOR || TARGET_OS_IOSMAC
45
46 #define DNSINFO_PROC_NAME "proc_name" // string
47
48 #define DNSINFO_REQUEST "request_op" // int64
49
50 enum {
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_OS_SIMULATOR || TARGET_OS_IOSMAC
66 #define NWI_SERVICE_NAME "com.apple.SystemConfiguration.NetworkInformation"
67 #else // !TARGET_OS_SIMULATOR || TARGET_OS_IOSMAC
68 #define NWI_SERVICE_NAME "com.apple.SystemConfiguration.NetworkInformation_sim"
69 #endif // !TARGET_OS_SIMULATOR || TARGET_OS_IOSMAC
70
71 #define NWI_PROC_NAME "proc_name" // string
72
73 #define NWI_REQUEST "request_op" // int64
74
75 enum {
76 /* NWI state requests */
77 NWI_STATE_REQUEST_COPY = 0x20001,
78 NWI_STATE_REQUEST_ACKNOWLEDGE,
79
80 #if !TARGET_OS_SIMULATOR || TARGET_OS_IOSMAC
81 /* NWI config agent requests */
82 NWI_CONFIG_AGENT_REQUEST_COPY
83 #endif // !TARGET_OS_SIMULATOR || TARGET_OS_IOSMAC
84 };
85
86 #define NWI_CONFIGURATION "configuration" // data
87 #define NWI_GENERATION "generation" // uint64
88
89 // ------------------------------------------------------------
90
91 typedef struct {
92 _Bool active;
93 xpc_connection_t connection;
94 char *service_description;
95 char *service_name;
96 } libSC_info_client_t;
97
98 // ------------------------------------------------------------
99
100 __BEGIN_DECLS
101
102 _Bool
103 libSC_info_available (void);
104
105 libSC_info_client_t *
106 libSC_info_client_create (
107 dispatch_queue_t q,
108 const char *service_name,
109 const char *service_description
110 );
111
112 void
113 libSC_info_client_release (
114 libSC_info_client_t *client
115 );
116
117 xpc_object_t
118 libSC_send_message_with_reply_sync (
119 libSC_info_client_t *client,
120 xpc_object_t message
121 );
122
123 __END_DECLS
124
125 #endif // _LIBSYSTEMCONFIGURATION_CLIENT_H