Imported Upstream version 878.70.2
[platform/upstream/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
44 #import <PreferencePanes/PreferencePanes.h>
45 #import <SecurityInterface/SFAuthorizationView.h>
46 #import <dns_sd.h>
47
48 @class CNBonjourDomainView;
49 @class CNDomainBrowserView;
50
51 @interface DNSServiceDiscoveryPref : NSPreferencePane
52 {
53     IBOutlet NSTextField          *hostName;
54     IBOutlet NSTextField          *sharedSecretName;
55     IBOutlet NSSecureTextField    *sharedSecretValue;
56     IBOutlet NSTextField          *browseDomainTextField;
57         IBOutlet NSTextField          *regDomainTextField;
58         IBOutlet CNBonjourDomainView  *regDomainView;
59     IBOutlet NSButton             *wideAreaCheckBox;
60     IBOutlet NSButton             *hostNameSharedSecretButton;
61         IBOutlet NSButton             *registrationSelectButton;
62         IBOutlet NSButton             *registrationSharedSecretButton;
63     IBOutlet NSButton             *applyButton;
64     IBOutlet NSButton             *revertButton;
65     IBOutlet NSWindow             *sharedSecretWindow;
66         IBOutlet NSWindow             *addBrowseDomainWindow;
67         IBOutlet NSWindow             *addBrowseDomainManualWindow;
68         IBOutlet NSWindow             *selectRegistrationDomainWindow;
69         IBOutlet NSWindow             *selectRegistrationDomainManualWindow;
70     IBOutlet NSButton             *addBrowseDomainButton;
71     IBOutlet NSButton             *removeBrowseDomainButton;
72     IBOutlet NSButton             *secretOKButton;
73     IBOutlet NSButton             *secretCancelButton;
74     IBOutlet NSImageView          *statusImageView;
75     IBOutlet NSTabView            *tabView;
76         IBOutlet NSTableView          *browseDomainList;
77         IBOutlet CNDomainBrowserView  *bonjourBrowserView;
78         IBOutlet CNDomainBrowserView  *registrationBrowserView;
79     IBOutlet SFAuthorizationView  *comboAuthButton;
80
81     NSWindow            *mainWindow;
82     NSString            *currentHostName;
83     NSString            *currentRegDomain;
84     NSArray             *currentBrowseDomainsArray;
85     NSMutableArray      *browseDomainsArray;
86     NSString            *defaultRegDomain;
87
88     NSString            *hostNameSharedSecretName;
89     NSString            *hostNameSharedSecretValue;
90     NSString            *regSharedSecretName;
91     NSString            *regSharedSecretValue;
92     BOOL                currentWideAreaState;
93     BOOL                prefsNeedUpdating;
94     BOOL                browseDomainListEnabled;
95     NSImage             *successImage;
96     NSImage             *inprogressImage;
97     NSImage             *failureImage;
98
99     NSMutableArray      *registrationDataSource;
100 }
101
102 -(IBAction)applyClicked : (id)sender;
103 -(IBAction)enableBrowseDomainClicked : (id)sender;
104 -(IBAction)addBrowseDomainClicked : (id)sender;
105 -(IBAction)removeBrowseDomainClicked : (id)sender;
106 -(IBAction)revertClicked : (id)sender;
107 -(IBAction)changeButtonPressed : (id)sender;
108 -(IBAction)closeMyCustomSheet : (id)sender;
109 -(IBAction)wideAreaCheckBoxChanged : (id)sender;
110
111
112 -(NSMutableArray *)registrationDataSource;
113 -(NSString *)currentRegDomain;
114 -(NSArray *)currentBrowseDomainsArray;
115 -(NSString *)currentHostName;
116 -(NSString *)defaultRegDomain;
117 -(void)setDefaultRegDomain : (NSString *)domain;
118
119
120 -(void)enableApplyButton;
121 -(void)disableApplyButton;
122 -(void)applyCurrentState;
123 -(void)setupInitialValues;
124 -(void)toggleWideAreaBonjour : (BOOL)state;
125 -(void)updateApplyButtonState;
126 -(void)enableControls;
127 -(void)disableControls;
128 -(void)validateTextFields;
129 -(void)readPreferences;
130 -(void)savePreferences;
131 -(void)restorePreferences;
132 -(void)watchForPreferenceChanges;
133 -(void)updateStatusImageView;
134
135
136 -(NSString *)sharedSecretKeyName : (NSString * )domain;
137 -(NSString *)domainForHostName : (NSString *)hostNameString;
138 -(int)statusForHostName : (NSString * )domain;
139 -(NSData *)dataForDomainArray : (NSArray *)domainArray;
140 -(NSData *)dataForDomain : (NSString *)domainName isEnabled : (BOOL)enabled;
141 -(NSDictionary *)dictionaryForSharedSecret : (NSString *)secret domain : (NSString *)domainName key : (NSString *)keyName;
142 -(BOOL)domainAlreadyInList : (NSString *)domainString;
143 -(NSString *)trimCharactersFromDomain : (NSString *)domain;
144
145
146 // Delegate methods
147 -(void)authorizationViewDidAuthorize : (SFAuthorizationView *)view;
148 -(void)authorizationViewDidDeauthorize : (SFAuthorizationView *)view;
149 -(void)mainViewDidLoad;
150 -(void)controlTextDidChange : (NSNotification *) notification;
151
152 @end