]> git.saurik.com Git - apple/mdnsresponder.git/blob - mDNSMacOSX/PreferencePane/DNSServiceDiscoveryPref.h
mDNSResponder-214.3.tar.gz
[apple/mdnsresponder.git] / mDNSMacOSX / PreferencePane / DNSServiceDiscoveryPref.h
1 /*
2 File: DNSServiceDiscoveryPref.h
3
4 Abstract: System Preference Pane for Dynamic DNS and Wide-Area DNS Service Discovery
5
6 Copyright: (c) Copyright 2005 Apple Computer, Inc. All rights reserved.
7
8 Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc.
9 ("Apple") in consideration of your agreement to the following terms, and your
10 use, installation, modification or redistribution of this Apple software
11 constitutes acceptance of these terms. If you do not agree with these terms,
12 please do not use, install, modify or redistribute this Apple software.
13
14 In consideration of your agreement to abide by the following terms, and subject
15 to these terms, Apple grants you a personal, non-exclusive license, under Apple's
16 copyrights in this original Apple software (the "Apple Software"), to use,
17 reproduce, modify and redistribute the Apple Software, with or without
18 modifications, in source and/or binary forms; provided that if you redistribute
19 the Apple Software in its entirety and without modifications, you must retain
20 this notice and the following text and disclaimers in all such redistributions of
21 the Apple Software. Neither the name, trademarks, service marks or logos of
22 Apple Computer, Inc. may be used to endorse or promote products derived from the
23 Apple Software without specific prior written permission from Apple. Except as
24 expressly stated in this notice, no other rights or licenses, express or implied,
25 are granted by Apple herein, including but not limited to any patent rights that
26 may be infringed by your derivative works or by other works in which the Apple
27 Software may be incorporated.
28
29 The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO
30 WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
31 WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
32 PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
33 COMBINATION WITH YOUR PRODUCTS.
34
35 IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
36 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
37 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION
39 OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT
40 (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN
41 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42
43 Change History (most recent first):
44
45 $Log: DNSServiceDiscoveryPref.h,v $
46 Revision 1.6 2006/08/14 23:15:47 cheshire
47 Tidy up Change History comment
48
49 Revision 1.5 2005/02/26 00:44:24 cheshire
50 Restore default reg domain if user deletes text and clicks "apply"
51
52 Revision 1.4 2005/02/25 02:29:28 cheshire
53 Show yellow dot for "update in progress"
54
55 Revision 1.3 2005/02/10 22:35:19 cheshire
56 <rdar://problem/3727944> Update name
57
58 Revision 1.2 2005/02/08 01:32:05 cheshire
59 Add trimCharactersFromDomain routine to strip leading and trailing
60 white space and punctuation from user-entered fields.
61
62 Revision 1.1 2005/02/05 01:59:19 cheshire
63 Add Preference Pane to facilitate testing of DDNS & wide-area features
64
65 */
66
67 #import <Cocoa/Cocoa.h>
68 #import <PreferencePanes/PreferencePanes.h>
69 #import <CoreFoundation/CoreFoundation.h>
70 #import <SecurityInterface/SFAuthorizationView.h>
71 #import <SystemConfiguration/SystemConfiguration.h>
72 #import <dns_sd.h>
73
74 typedef struct MyDNSServiceState {
75 DNSServiceRef service;
76 CFRunLoopSourceRef source;
77 CFSocketRef socket;
78 } MyDNSServiceState;
79
80
81 @interface DNSServiceDiscoveryPref : NSPreferencePane
82 {
83 IBOutlet NSTextField *hostName;
84 IBOutlet NSTextField *sharedSecretName;
85 IBOutlet NSSecureTextField *sharedSecretValue;
86 IBOutlet NSComboBox *browseDomainsComboBox;
87 IBOutlet NSComboBox *regDomainsComboBox;
88 IBOutlet NSButton *wideAreaCheckBox;
89 IBOutlet NSButton *hostNameSharedSecretButton;
90 IBOutlet NSButton *registrationSharedSecretButton;
91 IBOutlet NSButton *applyButton;
92 IBOutlet NSButton *revertButton;
93 IBOutlet NSWindow *sharedSecretWindow;
94 IBOutlet NSWindow *addBrowseDomainWindow;
95 IBOutlet NSButton *addBrowseDomainButton;
96 IBOutlet NSButton *removeBrowseDomainButton;
97 IBOutlet NSButton *browseOKButton;
98 IBOutlet NSButton *browseCancelButton;
99 IBOutlet NSButton *secretOKButton;
100 IBOutlet NSButton *secretCancelButton;
101 IBOutlet NSImageView *statusImageView;
102 IBOutlet NSTabView *tabView;
103 IBOutlet NSTableView *browseDomainList;
104 IBOutlet SFAuthorizationView *comboAuthButton;
105
106 NSWindow *mainWindow;
107 NSString *currentHostName;
108 NSString *currentRegDomain;
109 NSArray *currentBrowseDomainsArray;
110 NSMutableArray *browseDomainsArray;
111 NSMutableArray *defaultBrowseDomainsArray;
112 NSString *defaultRegDomain;
113
114 NSString *hostNameSharedSecretName;
115 NSString *hostNameSharedSecretValue;
116 NSString *regSharedSecretName;
117 NSString *regSharedSecretValue;
118 BOOL currentWideAreaState;
119 BOOL prefsNeedUpdating;
120 BOOL toolInstalled;
121 BOOL browseDomainListEnabled;
122 BOOL justStartedEditing;
123 NSImage *successImage;
124 NSImage *inprogressImage;
125 NSImage *failureImage;
126
127 MyDNSServiceState regQuery;
128 MyDNSServiceState browseQuery;
129 NSMutableArray *browseDataSource;
130 NSMutableArray *registrationDataSource;
131 }
132
133 - (IBAction)applyClicked:(id)sender;
134 - (IBAction)enableBrowseDomainClicked:(id)sender;
135 - (IBAction)addBrowseDomainClicked:(id)sender;
136 - (IBAction)removeBrowseDomainClicked:(id)sender;
137 - (IBAction)revertClicked:(id)sender;
138 - (IBAction)changeButtonPressed:(id)sender;
139 - (IBAction)closeMyCustomSheet:(id)sender;
140 - (IBAction)comboAction:(id)sender;
141 - (IBAction)wideAreaCheckBoxChanged:(id)sender;
142
143
144 - (NSMutableArray *)browseDataSource;
145 - (NSMutableArray *)registrationDataSource;
146 - (NSComboBox *)browseDomainsComboBox;
147 - (NSComboBox *)regDomainsComboBox;
148 - (NSString *)currentRegDomain;
149 - (NSMutableArray *)defaultBrowseDomainsArray;
150 - (NSArray *)currentBrowseDomainsArray;
151 - (NSString *)currentHostName;
152 - (NSString *)defaultRegDomain;
153 - (void)setDefaultRegDomain:(NSString *)domain;
154
155
156
157 - (void)enableApplyButton;
158 - (void)disableApplyButton;
159 - (void)applyCurrentState;
160 - (void)setBrowseDomainsComboBox;
161 - (void)setupInitialValues;
162 - (void)startDomainBrowsing;
163 - (void)toggleWideAreaBonjour:(BOOL)state;
164 - (void)updateApplyButtonState;
165 - (void)enableControls;
166 - (void)disableControls;
167 - (void)validateTextFields;
168 - (void)readPreferences;
169 - (void)savePreferences;
170 - (void)restorePreferences;
171 - (void)watchForPreferenceChanges;
172 - (void)updateStatusImageView;
173
174
175 - (NSString *)sharedSecretKeyName:(NSString * )domain;
176 - (NSString *)domainForHostName:(NSString *)hostNameString;
177 - (int)statusForHostName:(NSString * )domain;
178 - (NSData *)dataForDomainArray:(NSArray *)domainArray;
179 - (NSData *)dataForDomain:(NSString *)domainName isEnabled:(BOOL)enabled;
180 - (NSData *)dataForSharedSecret:(NSString *)secret domain:(NSString *)domainName key:(NSString *)keyName;
181 - (BOOL)domainAlreadyInList:(NSString *)domainString;
182 - (NSString *)trimCharactersFromDomain:(NSString *)domain;
183
184
185 // Delegate methods
186 - (void)authorizationViewDidAuthorize:(SFAuthorizationView *)view;
187 - (void)authorizationViewDidDeauthorize:(SFAuthorizationView *)view;
188 - (void)mainViewDidLoad;
189 - (int)numberOfItemsInComboBox:(NSComboBox *)aComboBox;
190 - (id)comboBox:(NSComboBox *)aComboBox objectValueForItemAtIndex:(int)index;
191 - (void)controlTextDidChange:(NSNotification *) notification;
192
193 @end