]> git.saurik.com Git - apple/security.git/blob - keychain/ot/OctagonFlags.h
Security-59306.61.1.tar.gz
[apple/security.git] / keychain / ot / OctagonFlags.h
1
2 #if OCTAGON
3
4 #import "keychain/ot/OctagonStateMachineHelpers.h"
5 #import "keychain/ot/OctagonPendingFlag.h"
6
7 NS_ASSUME_NONNULL_BEGIN
8
9 // OctagonFlags allow you to set binary flags for consumption by the state machine, similar to processor interrupts
10 // This allows the state machine to respond to external inputs or requests that don't need a timeout attached to them.
11 // Setting and removing flags are idempotent.
12
13 @protocol OctagonFlagContainer
14 - (BOOL)_onqueueContains:(OctagonFlag*)flag;
15 - (NSArray<NSString*>*)dumpFlags;
16 - (CKKSCondition*)conditionForFlag:(OctagonFlag*)flag;
17 @end
18
19 @protocol OctagonFlagSetter <OctagonFlagContainer>
20 - (void)setFlag:(OctagonFlag*)flag;
21 - (void)_onqueueSetFlag:(OctagonFlag*)flag;
22 @end
23
24 @protocol OctagonFlagClearer <OctagonFlagSetter>
25 - (void)_onqueueRemoveFlag:(OctagonFlag*)flag;
26 @end
27
28 @interface OctagonFlags : NSObject <OctagonFlagContainer,
29 OctagonFlagSetter,
30 OctagonFlagClearer>
31
32 @property NSMutableDictionary<OctagonFlag*, CKKSCondition*>* flagConditions;
33
34 - (instancetype)initWithQueue:(dispatch_queue_t)queue
35 flags:(NSSet<OctagonFlag*>*)possibleFlags;
36
37 - (NSString*)contentsAsString;
38 @end
39
40 NS_ASSUME_NONNULL_END
41
42 #endif // OCTAGON