]> git.saurik.com Git - apple/mdnsresponder.git/blob - mDNSMacOSX/PreferencePane/DNSServiceDiscoveryPref.h
mDNSResponder-108.4.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 $Log: DNSServiceDiscoveryPref.h,v $
45 Revision 1.5 2005/02/26 00:44:24 cheshire
46 Restore default reg domain if user deletes text and clicks "apply"
47
48 Revision 1.4 2005/02/25 02:29:28 cheshire
49 Show yellow dot for "update in progress"
50
51 Revision 1.3 2005/02/10 22:35:19 cheshire
52 <rdar://problem/3727944> Update name
53
54 Revision 1.2 2005/02/08 01:32:05 cheshire
55 Add trimCharactersFromDomain routine to strip leading and trailing
56 white space and punctuation from user-entered fields.
57
58 Revision 1.1 2005/02/05 01:59:19 cheshire
59 Add Preference Pane to facilitate testing of DDNS & wide-area features
60
61 */
62
63 #import <Cocoa/Cocoa.h>
64 #import <PreferencePanes/PreferencePanes.h>
65 #import <CoreFoundation/CoreFoundation.h>
66 #import <SecurityInterface/SFAuthorizationView.h>
67 #import <SystemConfiguration/SystemConfiguration.h>
68 #import <dns_sd.h>
69
70 typedef struct MyDNSServiceState {
71 DNSServiceRef service;
72 CFRunLoopSourceRef source;
73 CFSocketRef socket;
74 } MyDNSServiceState;
75
76
77 @interface DNSServiceDiscoveryPref : NSPreferencePane
78 {
79 IBOutlet NSTextField *hostName;
80 IBOutlet NSTextField *sharedSecretName;
81 IBOutlet NSSecureTextField *sharedSecretValue;
82 IBOutlet NSComboBox *browseDomainsComboBox;
83 IBOutlet NSComboBox *regDomainsComboBox;
84 IBOutlet NSButton *wideAreaCheckBox;
85 IBOutlet NSButton *hostNameSharedSecretButton;
86 IBOutlet NSButton *registrationSharedSecretButton;
87 IBOutlet NSButton *applyButton;
88 IBOutlet NSButton *revertButton;
89 IBOutlet NSWindow *sharedSecretWindow;
90 IBOutlet NSWindow *addBrowseDomainWindow;
91 IBOutlet NSButton *addBrowseDomainButton;
92 IBOutlet NSButton *removeBrowseDomainButton;
93 IBOutlet NSButton *browseOKButton;
94 IBOutlet NSButton *browseCancelButton;
95 IBOutlet NSButton *secretOKButton;
96 IBOutlet NSButton *secretCancelButton;
97 IBOutlet NSImageView *statusImageView;
98 IBOutlet NSTabView *tabView;
99 IBOutlet NSTableView *browseDomainList;
100 IBOutlet SFAuthorizationView *comboAuthButton;
101
102 NSWindow *mainWindow;
103 NSString *currentHostName;
104 NSString *currentRegDomain;
105 NSArray *currentBrowseDomainsArray;
106 NSMutableArray *browseDomainsArray;
107 NSMutableArray *defaultBrowseDomainsArray;
108 NSString *defaultRegDomain;
109
110 NSString *hostNameSharedSecretName;
111 NSString *hostNameSharedSecretValue;
112 NSString *regSharedSecretName;
113 NSString *regSharedSecretValue;
114 BOOL currentWideAreaState;
115 BOOL prefsNeedUpdating;
116 BOOL toolInstalled;
117 BOOL browseDomainListEnabled;
118 BOOL justStartedEditing;
119 NSImage *successImage;
120 NSImage *inprogressImage;
121 NSImage *failureImage;
122
123 MyDNSServiceState regQuery;
124 MyDNSServiceState browseQuery;
125 NSMutableArray *browseDataSource;
126 NSMutableArray *registrationDataSource;
127 }
128
129 - (IBAction)applyClicked:(id)sender;
130 - (IBAction)enableBrowseDomainClicked:(id)sender;
131 - (IBAction)addBrowseDomainClicked:(id)sender;
132 - (IBAction)removeBrowseDomainClicked:(id)sender;
133 - (IBAction)revertClicked:(id)sender;
134 - (IBAction)changeButtonPressed:(id)sender;
135 - (IBAction)closeMyCustomSheet:(id)sender;
136 - (IBAction)comboAction:(id)sender;
137 - (IBAction)wideAreaCheckBoxChanged:(id)sender;
138
139
140 - (NSMutableArray *)browseDataSource;
141 - (NSMutableArray *)registrationDataSource;
142 - (NSComboBox *)browseDomainsComboBox;
143 - (NSComboBox *)regDomainsComboBox;
144 - (NSString *)currentRegDomain;
145 - (NSMutableArray *)defaultBrowseDomainsArray;
146 - (NSArray *)currentBrowseDomainsArray;
147 - (NSString *)currentHostName;
148 - (NSString *)defaultRegDomain;
149 - (void)setDefaultRegDomain:(NSString *)domain;
150
151
152
153 - (void)enableApplyButton;
154 - (void)disableApplyButton;
155 - (void)applyCurrentState;
156 - (void)setBrowseDomainsComboBox;
157 - (void)setupInitialValues;
158 - (void)startDomainBrowsing;
159 - (void)toggleWideAreaBonjour:(BOOL)state;
160 - (void)updateApplyButtonState;
161 - (void)enableControls;
162 - (void)disableControls;
163 - (void)validateTextFields;
164 - (void)readPreferences;
165 - (void)savePreferences;
166 - (void)restorePreferences;
167 - (void)watchForPreferenceChanges;
168 - (void)updateStatusImageView;
169
170
171 - (NSString *)sharedSecretKeyName:(NSString * )domain;
172 - (NSString *)domainForHostName:(NSString *)hostNameString;
173 - (int)statusForHostName:(NSString * )domain;
174 - (NSData *)dataForDomainArray:(NSArray *)domainArray;
175 - (NSData *)dataForDomain:(NSString *)domainName isEnabled:(BOOL)enabled;
176 - (NSData *)dataForSharedSecret:(NSString *)secret domain:(NSString *)domainName key:(NSString *)keyName;
177 - (BOOL)domainAlreadyInList:(NSString *)domainString;
178 - (NSString *)trimCharactersFromDomain:(NSString *)domain;
179
180
181 // Delegate methods
182 - (void)authorizationViewDidAuthorize:(SFAuthorizationView *)view;
183 - (void)authorizationViewDidDeauthorize:(SFAuthorizationView *)view;
184 - (void)mainViewDidLoad;
185 - (int)numberOfItemsInComboBox:(NSComboBox *)aComboBox;
186 - (id)comboBox:(NSComboBox *)aComboBox objectValueForItemAtIndex:(int)index;
187 - (void)controlTextDidChange:(NSNotification *) notification;
188
189 @end