1/*
2 * Copyright (c) 2000-2004,2006,2011,2014 Apple Inc. All Rights Reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24
25//
26// ssnotify - constants for Security notifications
27//
28// This interface is private to the Security system. It is not a public interface,
29// and it may change at any time. You have been warned.
30//
31#ifndef _H_SSNOTIFY
32#define _H_SSNOTIFY
33
34
35#include <Security/cssm.h>
36
37namespace Security {
38namespace SecurityServer {
39
40
41//
42// Types
43//
44typedef uint32 NotificationDomain;  // message domain (group)
45typedef uint32 NotificationEvent;   // event number (within a domain)
46typedef uint32 NotificationMask;	// mask of events (containing 1 << event number)
47
48
49//
50// Values for notification domains.
51//
52enum {
53	kNotificationDomainAll			= 0, // all domains (useful for testing only)
54	kNotificationDomainDatabase		= 1, // something happened to a database (aka keychain)
55	kNotificationDomainPCSC			= 2, // pcscd-generated events
56	kNotificationDomainCDSA			= 3  // CDSA-layer events (for plugins)
57};
58
59
60//
61// Event codes are separate per domain, with a maximum of 32 event codes
62// per domain (0-31) so they fit into a uint32 mask set. For each domain,
63// this constant will thus select all possible events for that domain:
64//
65enum {
66	kNotificationAllEvents			= uint32(-1)	// mask of all events
67};
68
69
70//
71// Notification events for kNotificationDomainDatabase.
72// These are public events (vended through the "keychain notifications" API),
73// and the event numbers must match the public API.
74// The constants below only describe the subset of this domain whose events
75// are generated directly by securityd. The full complement is in
76// <Security/SecKeychain.h>, including those generated by clients for other
77// clients.
78//
79enum {
80	kNotificationEventLocked			= 1,	// a keychain was locked
81	kNotificationEventUnlocked			= 2,	// a keychain was unlocked
82	kNotificationEventPassphraseChanged = 6		// a keychain password was (possibly) changed
83};
84
85
86//
87// PCSC-related notifications.
88// These are generated by the PCSC daemon (pcscd), and are generally only
89// (directly) listened to by securityd, though they may be useful for other
90// programs that want to know when smart-card state is changing. This is
91// an Apple-specific feature of pcscd.
92//
93enum {
94	kNotificationPCSCStateChange		= 1,		// general PCSC state change
95	kNotificationPCSCInitialized		= 2			// pcscd has just started up
96};
97
98
99//
100// CDSA-related notifications.
101// These are generated by securityd, and are listened to by CDSA plugins
102// that need to generate CDSA-layer event notifications. This feature is
103// internal to Apple's smart-card support architecture; the official (CDSA)
104// standard events are sent by the plugins to CSSM (as a result of receiving
105// these events).
106//
107enum {
108	kNotificationCDSAInsertion			= 1,	// CDSA insertion event
109	kNotificationCDSARemoval			= 2,	// CDSA removal event
110	kNotificationCDSAFailure			= 3		// CDSA failure event
111};
112
113
114} // end namespace SecurityServer
115} // end namespace Security
116
117
118#endif //_H_SSNOTIFY
119