]> git.saurik.com Git - apple/configd.git/blob - SystemConfiguration.fproj/SCProxies.c
d31c8266ec12cc717fbec37101c96e68b784c8b6
[apple/configd.git] / SystemConfiguration.fproj / SCProxies.c
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22
23 /*
24 * Modification History
25 *
26 * May 18, 2001 Allan Nathanson <ajn@apple.com>
27 * - initial revision
28 */
29
30 #include <SystemConfiguration/SystemConfiguration.h>
31 #include <SystemConfiguration/SCPrivate.h>
32 #include <SystemConfiguration/SCValidation.h>
33
34 CFStringRef
35 SCDynamicStoreKeyCreateProxies(CFAllocatorRef allocator)
36 {
37 return SCDynamicStoreKeyCreateNetworkGlobalEntity(allocator,
38 kSCDynamicStoreDomainState,
39 kSCEntNetProxies);
40 }
41
42
43 CFDictionaryRef
44 SCDynamicStoreCopyProxies(SCDynamicStoreRef store)
45 {
46 CFDictionaryRef dict = NULL;
47 CFStringRef key;
48 SCDynamicStoreRef mySession = store;
49 CFDictionaryRef proxies = NULL;
50
51 if (!store) {
52 mySession = SCDynamicStoreCreate(NULL,
53 CFSTR("SCDynamicStoreCopyConsoleUser"),
54 NULL,
55 NULL);
56 if (!mySession) {
57 SCLog(_sc_verbose, LOG_INFO, CFSTR("SCDynamicStoreCreate() failed"));
58 return NULL;
59 }
60 }
61
62 key = SCDynamicStoreKeyCreateProxies(NULL);
63 dict = SCDynamicStoreCopyValue(mySession, key);
64 CFRelease(key);
65 if (!isA_CFDictionary(dict)) {
66 _SCErrorSet(kSCStatusNoKey);
67 goto done;
68 }
69
70 proxies = CFRetain(dict);
71
72 done :
73
74 if (!store && mySession) CFRelease(mySession);
75 if (dict) CFRelease(dict);
76 return proxies;
77 }