1/*
2 * Copyright (c) 2009-2012 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 _EAP8021X_EAPOLCLIENTCONFIGURATIONINTERNAL_H
25#define _EAP8021X_EAPOLCLIENTCONFIGURATIONINTERNAL_H
26
27#include <EAP8021X/EAPOLClientConfiguration.h>
28#include <CoreFoundation/CFRuntime.h>
29#include <SystemConfiguration/SCPreferences.h>
30#include "symbol_scope.h"
31
32/*
33 * EAPOLClientConfigurationInternal.h
34 * - EAPOL client configuration internal data structures, functions
35 */
36
37/*
38 * Modification History
39 *
40 * December 8, 2009	Dieter Siegmund (dieter@apple.com)
41 * - created
42 */
43
44/*
45 * EAPOLClientConfiguration SCPreferences prefsID
46 */
47#define kEAPOLClientConfigurationPrefsID   CFSTR("com.apple.network.eapolclient.configuration.plist")
48
49/**
50 ** EAPOLClientConfiguration
51 **/
52struct __EAPOLClientConfiguration {
53    CFRuntimeBase		cf_base;
54
55    AuthorizationExternalForm *	auth_ext_p;
56    SCPreferencesRef		eap_prefs;
57    SCPreferencesRef		sc_prefs;
58    CFMutableArrayRef		sc_changed_if;	/* of SCNetworkInterfaceRef */
59    CFMutableDictionaryRef	profiles;	/* of EAPOLClientProfileRef */
60    CFMutableDictionaryRef	ssids;		/* ssid -> profileID */
61    CFMutableDictionaryRef	domains;	/* domain -> profileID */
62    CFDictionaryRef		def_auth_props;	/* EAPClientProperties.h */
63    Boolean			def_auth_props_changed;
64};
65
66/**
67 ** EAPOLClientProfile
68 **/
69struct __EAPOLClientProfile {
70    CFRuntimeBase		cf_base;
71
72    EAPOLClientConfigurationRef	cfg;
73    CFStringRef			uuid;
74    CFDictionaryRef		auth_props;
75    CFStringRef			user_defined_name;
76    struct {
77	/* non HS 2.0 */
78	CFDataRef		ssid;
79	CFStringRef		security_type;
80
81	/* HS 2.0 */
82	CFStringRef		domain;
83    } WLAN;
84    CFMutableDictionaryRef	information;
85};
86
87/**
88 ** EAPOLClientItemID
89 **/
90typedef enum {
91    kEAPOLClientItemIDTypeNone = 0,
92    kEAPOLClientItemIDTypeWLANSSID = 1,
93    kEAPOLClientItemIDTypeProfileID = 2,
94    kEAPOLClientItemIDTypeProfile = 3,
95    kEAPOLClientItemIDTypeDefault = 4,
96    kEAPOLClientItemIDTypeWLANDomain = 5
97} EAPOLClientItemIDType;
98
99struct __EAPOLClientItemID {
100    CFRuntimeBase		cf_base;
101
102    EAPOLClientItemIDType	type;
103    union {
104	CFDataRef		ssid;
105	CFStringRef		profileID;
106	EAPOLClientProfileRef	profile;
107	CFStringRef		domain;
108	const void *		ptr;
109    } u;
110};
111
112
113/**
114 ** EAPOLClientConfiguration functions
115 **/
116PRIVATE_EXTERN void
117EAPOLClientConfigurationSetProfileForSSID(EAPOLClientConfigurationRef cfg,
118					  CFDataRef ssid,
119					  EAPOLClientProfileRef profile);
120PRIVATE_EXTERN void
121EAPOLClientConfigurationSetProfileForWLANDomain(EAPOLClientConfigurationRef cfg,
122						CFStringRef domain,
123						EAPOLClientProfileRef profile);
124PRIVATE_EXTERN AuthorizationExternalForm *
125EAPOLClientConfigurationGetAuthorizationExternalForm(EAPOLClientConfigurationRef cfg);
126
127/**
128 ** EAPOLClientProfile functions
129 **/
130PRIVATE_EXTERN EAPOLClientProfileRef
131EAPOLClientProfileCreateWithDictAndProfileID(CFDictionaryRef dict,
132					     CFStringRef profileID);
133PRIVATE_EXTERN CFMutableDictionaryRef
134EAPOLClientProfileCreateDictAndProfileID(EAPOLClientProfileRef profile,
135					 CFStringRef * ret_profileID);
136PRIVATE_EXTERN void
137EAPOLClientProfileSetConfiguration(EAPOLClientProfileRef profile,
138				   EAPOLClientConfigurationRef cfg);
139PRIVATE_EXTERN EAPOLClientConfigurationRef
140EAPOLClientProfileGetConfiguration(EAPOLClientProfileRef profile);
141
142PRIVATE_EXTERN Boolean
143accept_types_valid(CFArrayRef accept);
144
145/**
146 ** EAPOLClientItemID functions
147 **/
148PRIVATE_EXTERN AuthorizationExternalForm *
149EAPOLClientItemIDGetAuthorizationExternalForm(EAPOLClientItemIDRef itemID);
150
151
152#endif /* _EAP8021X_EAPOLCLIENTCONFIGURATIONINTERNAL_H */
153