2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
23 #ifndef __USERNOTIFICATION_KUNCUSERNOTIFICATIONS_H
24 #define __USERNOTIFICATION_KUNCUSERNOTIFICATIONS_H
26 #include <sys/cdefs.h>
29 #include <mach/message.h>
30 #include <mach/kern_return.h>
31 #include <UserNotification/UNDTypes.h>
36 * non blocking notice call.
39 KUNCUserNotificationDisplayNotice(
44 char *localizationPath
,
47 char *defaultButtonTitle
);
50 * ***BLOCKING*** alert call, returned int value corresponds to the
51 * pressed button, spin this off in a thread only, or expect your kext to block.
54 KUNCUserNotificationDisplayAlert(
59 char *localizationPath
,
62 char *defaultButtonTitle
,
63 char *alternateButtonTitle
,
64 char *otherButtonTitle
,
65 unsigned *responseFlags
);
68 * Execute a userland executable with the given path, user and type
71 #define kOpenApplicationPath 0 /* essentially executes the path */
72 #define kOpenPreferencePanel 1 /* runs the preferences with the foo.preference opened. foo.preference must exist in /System/Library/Preferences */
73 #define kOpenApplication 2 /* essentially runs /usr/bin/open on the passed in application name */
76 #define kOpenAppAsRoot 0
77 #define kOpenAppAsConsoleUser 1
83 int pathExecutionType
);
86 /* KUNC User Notification XML Keys
88 * These are the keys used in the xml plist file passed in to the
89 * KUNCUserNotitificationDisplayFrom* calls
91 * KUNC Notifications are completely dependent on CFUserNotifications in
92 * user land. The same restrictions apply, including the number of text fields,
93 * types of information displayable, etc.
96 * Header string (header displayed on dialog)
97 * Icon URL string (url of the icon to display)
98 * Sound URL string (url of the sound to play on display)
99 * Localization URL string (url of bundle to retrieve localization
100 * info from, using Localizable.strings files)
101 * Message string (text of the message, can contain %@'s
102 * which are filled from tokenString passed in)
103 * OK Button Title string (title of the "main" button)
104 * Alternate Button Title string (title of the "alternate" button -
106 * Other Button Title string (title of the "other" button)
107 * Timeout string (numeric, int - seconds until the dialog
108 * goes away on it's own)
109 * Alert Level string (Stop, Notice, Alert,
110 * Blocking Message string (numeric, 1 or 0 - if 1, the dialog will
112 * Text Field Strings array of strings (each becomes a text field)
113 * Password Fields array of strings (numeric - each indicates a
115 * Popup Button Strings array of strings (each entry becomes a popup
117 * Radio Button Strings array of strings (each becomes a radio button)
118 * Check Box Strings array of strings (each becomes a check box)
119 * Selected Radio string (numeric - which radio is selected)
120 * Checked Boxes array of strings (numeric - each indicates a
122 * Selected Popup string (numeric - which popup entry is selected)
131 * path to the actual bundle (not inside of it)
132 * (i.e. "/System/Library/Extensions/Foo.kext")
134 * This WILL change soon to expect the CFBundleIdentifier instead of a bundle path
136 * filename in bundle to retrive the xml from (i.e. "Messages")
138 * if fileName has an extension, it goes here (i.e., "dict");
140 * name of the xml key in the dictionary in the file to retrieve
141 * the info from (i.e., "Error Message")
143 * a string in the form of "foo@bar" where each element is
144 * seperated by the @ character. This string can be used to
145 * replace values of the form %@ in the message key in the provided
146 * dictionary in the xml plist
148 * user specified key for notification, use this to match return
149 * values with your requested notification, this value is passed
150 * back to the client in the callback pararmeter contextKey
153 typedef int KUNCUserNotificationID
;
156 * Reponse value checking & default setting
158 * The reponse value returned in the response Flags of the
159 * KUNCUserNotificationCallBack can be tested against the following
160 * enum and 2 defines to determine the state.
164 kKUNCDefaultResponse
= 0,
165 kKUNCAlternateResponse
= 1,
166 kKUNCOtherResponse
= 2,
167 kKUNCCancelResponse
= 3
170 #define KUNCCheckBoxChecked(i) (1 << (8 + i)) /* can be used for radio's too */
171 #define KUNCPopUpSelection(n) (n << 24)
174 * Callback function for KUNCNotifications
177 (*KUNCUserNotificationCallBack
)(
183 * Get a notification ID
185 KUNCUserNotificationID
KUNCGetNotificationID();
188 /* 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. */
191 KUNCUserNotificationDisplayFromBundle(
192 KUNCUserNotificationID notificationID
,
193 char *bundleIdentifier
,
198 KUNCUserNotificationCallBack callback
,
203 KUNCUserNotificationCancel(
204 KUNCUserNotificationID notification
);
209 #endif /* __USERNOTIFICATION_KUNCUSERNOTIFICATIONS_H */