]>
git.saurik.com Git - apple/security.git/blob - SecurityServer/notifications.h
2 * Copyright (c) 2000-2002 Apple Computer, Inc. All Rights Reserved.
4 * The contents of this file constitute Original Code as defined in and are
5 * subject to the Apple Public Source License Version 1.2 (the 'License').
6 * You may not use this file except in compliance with the License. Please obtain
7 * a copy of the License at http://www.apple.com/publicsource and read it before
10 * This Original Code and all software distributed under the License are
11 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS
12 * OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT
13 * LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
14 * PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the
15 * specific language governing rights and limitations under the License.
22 #ifndef _H_NOTIFICATIONS
23 #define _H_NOTIFICATIONS
25 #include <Security/mach++.h>
26 #include <Security/globalizer.h>
30 using namespace MachPlusPlus
;
37 // A registered receiver of notifications.
38 // Each one is for a particular database (or all), set of events,
39 // and to a particular Mach port. A process may have any number
40 // of listeners, each independent; so that multiple notifications can
41 // be sent to the same process if it registers repeatedly.
46 lockedEvent
= 1, // a keychain was locked
47 unlockedEvent
= 2, // a keychain was unlocked
48 passphraseChangedEvent
= 6, // a keychain password was (possibly) changed
50 allEvents
= lockedEvent
| unlockedEvent
| passphraseChangedEvent
52 typedef uint32 Event
, EventMask
;
55 allNotifications
= 0, // all domains (useful for testing only)
56 databaseNotifications
= 1 // something happened to a database (aka keychain)
58 typedef uint32 Domain
;
61 Listener(Process
&proc
, Port receiver
, Domain domain
, EventMask evs
= allEvents
);
66 const EventMask events
;
68 virtual void notifyMe(Domain domain
, Event event
, const CssmData
&data
);
69 static void notify(Domain domain
, Event event
, const CssmData
&data
);
70 static bool remove(Port port
);
73 Port mNotificationPort
;
76 typedef multimap
<mach_port_t
, Listener
*> ListenerMap
;
77 static ListenerMap listeners
;
82 #endif //_H_NOTIFICATIONS