]>
git.saurik.com Git - apple/security.git/blob - Network/observer.h
2 * Copyright (c) 2000-2001 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.
20 // observer - notification client for network events
25 #include <Security/utilities.h>
36 // An Observer object has a set (bitmask) of events it is interested in.
37 // Observers are registered with Transfer and Manager objects to take effect.
45 noEvents
= 0x000000, // mask for no events
46 transferStarting
= 0x000001, // starting transfer operation
47 transferComplete
= 0x000002, // successfully finished
48 transferFailed
= 0x000004, // failed somehow
49 connectEvent
= 0x000800, // transport level connection done or failed
50 protocolSend
= 0x001000, // low-level protocol message sent
51 protocolReceive
= 0x002000, // low-level protocol message received
54 resourceFound
= 0x000008, // resource found, OK to continue
55 downloading
= 0x000010, // downloading in progress
56 aborting
= 0x000020, // abort in progress
57 dataAvailable
= 0x000040, // data ready to go
58 systemEvent
= 0x000080, // ???
59 percentEvent
= 0x000100, // a >= 1% data move has occurred
60 periodicEvent
= 0x000200, // call every so often (.25 sec)
61 propertyChangedEvent
= 0x000400,
62 resultCodeReady
= 0x004000, // result code has been received by HTTP
63 uploading
= 0x008000, // uploading
65 allEvents
= 0xFFFFFFFF // mask for all events
67 typedef uint32 Event
, Events
;
69 void setEvents(Events mask
) { mEventMask
= mask
; }
70 Events
getEvents() const { return mEventMask
; }
71 bool wants(Events events
) const { return mEventMask
& events
; }
73 virtual void observe(Events events
, Transfer
*xfer
, const void *info
= NULL
) = 0;
80 } // end namespace Network
81 } // end namespace Security