2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
23 * @APPLE_LICENSE_HEADER_END@
26 #ifndef __USERNOTIFICATION_KUNCUSERNOTIFICATIONS_H
27 #define __USERNOTIFICATION_KUNCUSERNOTIFICATIONS_H
29 #include <sys/cdefs.h>
32 #include <mach/message.h>
33 #include <mach/kern_return.h>
34 #include <UserNotification/UNDTypes.h>
39 * non blocking notice call.
42 KUNCUserNotificationDisplayNotice(
47 char *localizationPath
,
50 char *defaultButtonTitle
);
53 * ***BLOCKING*** alert call, returned int value corresponds to the
54 * pressed button, spin this off in a thread only, or expect your kext to block.
57 KUNCUserNotificationDisplayAlert(
62 char *localizationPath
,
65 char *defaultButtonTitle
,
66 char *alternateButtonTitle
,
67 char *otherButtonTitle
,
68 unsigned *responseFlags
);
71 * Execute a userland executable with the given path, user and type
74 #define kOpenApplicationPath 0 /* essentially executes the path */
75 #define kOpenPreferencePanel 1 /* runs the preferences with the foo.preference opened. foo.preference must exist in /System/Library/Preferences */
76 #define kOpenApplication 2 /* essentially runs /usr/bin/open on the passed in application name */
79 #define kOpenAppAsRoot 0
80 #define kOpenAppAsConsoleUser 1
86 int pathExecutionType
);
89 /* KUNC User Notification XML Keys
91 * These are the keys used in the xml plist file passed in to the
92 * KUNCUserNotitificationDisplayFrom* calls
94 * KUNC Notifications are completely dependent on CFUserNotifications in
95 * user land. The same restrictions apply, including the number of text fields,
96 * types of information displayable, etc.
99 * Header string (header displayed on dialog)
100 * Icon URL string (url of the icon to display)
101 * Sound URL string (url of the sound to play on display)
102 * Localization URL string (url of bundle to retrieve localization
103 * info from, using Localizable.strings files)
104 * Message string (text of the message, can contain %@'s
105 * which are filled from tokenString passed in)
106 * OK Button Title string (title of the "main" button)
107 * Alternate Button Title string (title of the "alternate" button -
109 * Other Button Title string (title of the "other" button)
110 * Timeout string (numeric, int - seconds until the dialog
111 * goes away on it's own)
112 * Alert Level string (Stop, Notice, Alert,
113 * Blocking Message string (numeric, 1 or 0 - if 1, the dialog will
115 * Text Field Strings array of strings (each becomes a text field)
116 * Password Fields array of strings (numeric - each indicates a
118 * Popup Button Strings array of strings (each entry becomes a popup
120 * Radio Button Strings array of strings (each becomes a radio button)
121 * Check Box Strings array of strings (each becomes a check box)
122 * Selected Radio string (numeric - which radio is selected)
123 * Checked Boxes array of strings (numeric - each indicates a
125 * Selected Popup string (numeric - which popup entry is selected)
134 * path to the actual bundle (not inside of it)
135 * (i.e. "/System/Library/Extensions/Foo.kext")
137 * This WILL change soon to expect the CFBundleIdentifier instead of a bundle path
139 * filename in bundle to retrive the xml from (i.e. "Messages")
141 * if fileName has an extension, it goes here (i.e., "dict");
143 * name of the xml key in the dictionary in the file to retrieve
144 * the info from (i.e., "Error Message")
146 * a string in the form of "foo@bar" where each element is
147 * seperated by the @ character. This string can be used to
148 * replace values of the form %@ in the message key in the provided
149 * dictionary in the xml plist
151 * user specified key for notification, use this to match return
152 * values with your requested notification, this value is passed
153 * back to the client in the callback pararmeter contextKey
156 typedef int KUNCUserNotificationID
;
159 * Reponse value checking & default setting
161 * The reponse value returned in the response Flags of the
162 * KUNCUserNotificationCallBack can be tested against the following
163 * enum and 2 defines to determine the state.
167 kKUNCDefaultResponse
= 0,
168 kKUNCAlternateResponse
= 1,
169 kKUNCOtherResponse
= 2,
170 kKUNCCancelResponse
= 3
173 #define KUNCCheckBoxChecked(i) (1 << (8 + i)) /* can be used for radio's too */
174 #define KUNCPopUpSelection(n) (n << 24)
177 * Callback function for KUNCNotifications
180 (*KUNCUserNotificationCallBack
)(
186 * Get a notification ID
188 KUNCUserNotificationID
KUNCGetNotificationID();
191 /* This function currently requires a bundle path, which kexts cannot currently get. In the future, the CFBundleIdentiofier of the kext will be pass in in place of the bundlePath. */
194 KUNCUserNotificationDisplayFromBundle(
195 KUNCUserNotificationID notificationID
,
196 char *bundleIdentifier
,
201 KUNCUserNotificationCallBack callback
,
206 KUNCUserNotificationCancel(
207 KUNCUserNotificationID notification
);
212 #endif /* __USERNOTIFICATION_KUNCUSERNOTIFICATIONS_H */