1 // This file was automatically generated by protocompiler
3 // Compiled from OTAccountMetadataClassC.proto
5 #import <Foundation/Foundation.h>
6 #import <ProtocolBuffer/PBCodable.h>
9 * The state of accounts on the system is complicated. Here's how we handle them:
10 * If there is no account, we will be in NO_ACCOUNT and have no altDSID
11 * If there is an SA account, we will bt in NO_ACCOUNT and have an altDSID
12 * If there is an HSA2 account, we will be in ACCOUNT_AVAILABLE and have an altDSID
13 * Once you're in an HSA2 account, CDP might be enabled or disabled. If it's not enabled,
14 * then Octagon shouldn't be active.
16 typedef NS_ENUM(int32_t, OTAccountMetadataClassC_AccountState
) {
17 OTAccountMetadataClassC_AccountState_UNKNOWN
= 0,
18 OTAccountMetadataClassC_AccountState_NO_ACCOUNT
= 1,
19 OTAccountMetadataClassC_AccountState_ACCOUNT_AVAILABLE
= 2,
20 OTAccountMetadataClassC_AccountState_ACCOUNT_AVAILABLE_UNUSED
= 3,
23 NS_INLINE NSString
*OTAccountMetadataClassC_AccountStateAsString(OTAccountMetadataClassC_AccountState value
)
27 case OTAccountMetadataClassC_AccountState_UNKNOWN
: return @
"UNKNOWN";
28 case OTAccountMetadataClassC_AccountState_NO_ACCOUNT
: return @
"NO_ACCOUNT";
29 case OTAccountMetadataClassC_AccountState_ACCOUNT_AVAILABLE
: return @
"ACCOUNT_AVAILABLE";
30 case OTAccountMetadataClassC_AccountState_ACCOUNT_AVAILABLE_UNUSED
: return @
"ACCOUNT_AVAILABLE_UNUSED";
31 default: return [NSString stringWithFormat
:@
"(unknown: %i)", value
];
36 NS_INLINE OTAccountMetadataClassC_AccountState
StringAsOTAccountMetadataClassC_AccountState(NSString
*value
)
38 if ([value isEqualToString
:@
"UNKNOWN"]) return OTAccountMetadataClassC_AccountState_UNKNOWN
;
39 if ([value isEqualToString
:@
"NO_ACCOUNT"]) return OTAccountMetadataClassC_AccountState_NO_ACCOUNT
;
40 if ([value isEqualToString
:@
"ACCOUNT_AVAILABLE"]) return OTAccountMetadataClassC_AccountState_ACCOUNT_AVAILABLE
;
41 if ([value isEqualToString
:@
"ACCOUNT_AVAILABLE_UNUSED"]) return OTAccountMetadataClassC_AccountState_ACCOUNT_AVAILABLE_UNUSED
;
42 return OTAccountMetadataClassC_AccountState_UNKNOWN
;
45 typedef NS_ENUM(int32_t, OTAccountMetadataClassC_TrustState
) {
46 OTAccountMetadataClassC_TrustState_UNKNOWN
= 0,
47 OTAccountMetadataClassC_TrustState_UNTRUSTED
= 1,
48 OTAccountMetadataClassC_TrustState_TRUSTED
= 2,
51 NS_INLINE NSString
*OTAccountMetadataClassC_TrustStateAsString(OTAccountMetadataClassC_TrustState value
)
55 case OTAccountMetadataClassC_TrustState_UNKNOWN
: return @
"UNKNOWN";
56 case OTAccountMetadataClassC_TrustState_UNTRUSTED
: return @
"UNTRUSTED";
57 case OTAccountMetadataClassC_TrustState_TRUSTED
: return @
"TRUSTED";
58 default: return [NSString stringWithFormat
:@
"(unknown: %i)", value
];
63 NS_INLINE OTAccountMetadataClassC_TrustState
StringAsOTAccountMetadataClassC_TrustState(NSString
*value
)
65 if ([value isEqualToString
:@
"UNKNOWN"]) return OTAccountMetadataClassC_TrustState_UNKNOWN
;
66 if ([value isEqualToString
:@
"UNTRUSTED"]) return OTAccountMetadataClassC_TrustState_UNTRUSTED
;
67 if ([value isEqualToString
:@
"TRUSTED"]) return OTAccountMetadataClassC_TrustState_TRUSTED
;
68 return OTAccountMetadataClassC_TrustState_UNKNOWN
;
71 typedef NS_ENUM(int32_t, OTAccountMetadataClassC_AttemptedAJoinState
) {
72 OTAccountMetadataClassC_AttemptedAJoinState_UNKNOWN
= 0,
73 OTAccountMetadataClassC_AttemptedAJoinState_NOTATTEMPTED
= 1,
74 OTAccountMetadataClassC_AttemptedAJoinState_ATTEMPTED
= 2,
77 NS_INLINE NSString
*OTAccountMetadataClassC_AttemptedAJoinStateAsString(OTAccountMetadataClassC_AttemptedAJoinState value
)
81 case OTAccountMetadataClassC_AttemptedAJoinState_UNKNOWN
: return @
"UNKNOWN";
82 case OTAccountMetadataClassC_AttemptedAJoinState_NOTATTEMPTED
: return @
"NOTATTEMPTED";
83 case OTAccountMetadataClassC_AttemptedAJoinState_ATTEMPTED
: return @
"ATTEMPTED";
84 default: return [NSString stringWithFormat
:@
"(unknown: %i)", value
];
89 NS_INLINE OTAccountMetadataClassC_AttemptedAJoinState
StringAsOTAccountMetadataClassC_AttemptedAJoinState(NSString
*value
)
91 if ([value isEqualToString
:@
"UNKNOWN"]) return OTAccountMetadataClassC_AttemptedAJoinState_UNKNOWN
;
92 if ([value isEqualToString
:@
"NOTATTEMPTED"]) return OTAccountMetadataClassC_AttemptedAJoinState_NOTATTEMPTED
;
93 if ([value isEqualToString
:@
"ATTEMPTED"]) return OTAccountMetadataClassC_AttemptedAJoinState_ATTEMPTED
;
94 return OTAccountMetadataClassC_AttemptedAJoinState_UNKNOWN
;
97 typedef NS_ENUM(int32_t, OTAccountMetadataClassC_CDPState
) {
98 OTAccountMetadataClassC_CDPState_UNKNOWN
= 0,
99 OTAccountMetadataClassC_CDPState_DISABLED
= 1,
100 OTAccountMetadataClassC_CDPState_ENABLED
= 2,
103 NS_INLINE NSString
*OTAccountMetadataClassC_CDPStateAsString(OTAccountMetadataClassC_CDPState value
)
107 case OTAccountMetadataClassC_CDPState_UNKNOWN
: return @
"UNKNOWN";
108 case OTAccountMetadataClassC_CDPState_DISABLED
: return @
"DISABLED";
109 case OTAccountMetadataClassC_CDPState_ENABLED
: return @
"ENABLED";
110 default: return [NSString stringWithFormat
:@
"(unknown: %i)", value
];
113 #endif /* __OBJC__ */
115 NS_INLINE OTAccountMetadataClassC_CDPState
StringAsOTAccountMetadataClassC_CDPState(NSString
*value
)
117 if ([value isEqualToString
:@
"UNKNOWN"]) return OTAccountMetadataClassC_CDPState_UNKNOWN
;
118 if ([value isEqualToString
:@
"DISABLED"]) return OTAccountMetadataClassC_CDPState_DISABLED
;
119 if ([value isEqualToString
:@
"ENABLED"]) return OTAccountMetadataClassC_CDPState_ENABLED
;
120 return OTAccountMetadataClassC_CDPState_UNKNOWN
;
122 #endif /* __OBJC__ */
125 #define OTACCOUNTMETADATACLASSC_FUNCTION extern "C" __attribute__((visibility("hidden")))
127 #define OTACCOUNTMETADATACLASSC_FUNCTION extern __attribute__((visibility("hidden")))
130 __attribute__((visibility("hidden")))
131 @interface OTAccountMetadataClassC
: PBCodable
<NSCopying
>
134 uint64_t _lastHealthCheckup
;
136 OTAccountMetadataClassC_AttemptedAJoinState _attemptedJoin
;
137 OTAccountMetadataClassC_CDPState _cdpState
;
138 OTAccountMetadataClassC_AccountState _icloudAccountState
;
140 NSData
*_syncingPolicy
;
141 OTAccountMetadataClassC_TrustState _trustState
;
143 NSData
*_voucherSignature
;
146 int lastHealthCheckup
:1;
149 int icloudAccountState
:1;
155 @
property (nonatomic
, readonly
) BOOL hasPeerID
;
156 @
property (nonatomic
, retain
) NSString
*peerID
;
158 @
property (nonatomic
) BOOL hasIcloudAccountState
;
159 @
property (nonatomic
) OTAccountMetadataClassC_AccountState icloudAccountState
;
160 - (NSString
*)icloudAccountStateAsString
:(OTAccountMetadataClassC_AccountState
)value
;
161 - (OTAccountMetadataClassC_AccountState
)StringAsIcloudAccountState
:(NSString
*)str
;
163 @
property (nonatomic
) BOOL hasEpoch
;
164 @
property (nonatomic
) int64_t epoch
;
166 @
property (nonatomic
, readonly
) BOOL hasAltDSID
;
167 @
property (nonatomic
, retain
) NSString
*altDSID
;
169 @
property (nonatomic
) BOOL hasTrustState
;
170 @
property (nonatomic
) OTAccountMetadataClassC_TrustState trustState
;
171 - (NSString
*)trustStateAsString
:(OTAccountMetadataClassC_TrustState
)value
;
172 - (OTAccountMetadataClassC_TrustState
)StringAsTrustState
:(NSString
*)str
;
174 @
property (nonatomic
) BOOL hasLastHealthCheckup
;
175 /** Holds the time, in milliseconds since 1970, that the last health checkup query to Cuttlefish was successfully performed */
176 @
property (nonatomic
) uint64_t lastHealthCheckup
;
178 @
property (nonatomic
) BOOL hasAttemptedJoin
;
179 @
property (nonatomic
) OTAccountMetadataClassC_AttemptedAJoinState attemptedJoin
;
180 - (NSString
*)attemptedJoinAsString
:(OTAccountMetadataClassC_AttemptedAJoinState
)value
;
181 - (OTAccountMetadataClassC_AttemptedAJoinState
)StringAsAttemptedJoin
:(NSString
*)str
;
183 @
property (nonatomic
) BOOL hasCdpState
;
184 @
property (nonatomic
) OTAccountMetadataClassC_CDPState cdpState
;
185 - (NSString
*)cdpStateAsString
:(OTAccountMetadataClassC_CDPState
)value
;
186 - (OTAccountMetadataClassC_CDPState
)StringAsCdpState
:(NSString
*)str
;
188 @
property (nonatomic
, readonly
) BOOL hasSyncingPolicy
;
190 * Used during development
193 * This holds the current syncing policy for the local peer, including the view list.
195 @
property (nonatomic
, retain
) NSData
*syncingPolicy
;
197 @
property (nonatomic
, readonly
) BOOL hasVoucher
;
198 /** This might contain a voucher for use in joining Octagon. */
199 @
property (nonatomic
, retain
) NSData
*voucher
;
201 @
property (nonatomic
, readonly
) BOOL hasVoucherSignature
;
202 @
property (nonatomic
, retain
) NSData
*voucherSignature
;
204 // Performs a shallow copy into other
205 - (void)copyTo
:(OTAccountMetadataClassC
*)other
;
207 // Performs a deep merge from other into self
208 // If set in other, singular values in self are replaced in self
209 // Singular composite values are recursively merged
210 // Repeated values from other are appended to repeated values in self
211 - (void)mergeFrom
:(OTAccountMetadataClassC
*)other
;
213 OTACCOUNTMETADATACLASSC_FUNCTION BOOL
OTAccountMetadataClassCReadFrom(__unsafe_unretained OTAccountMetadataClassC
*self
, __unsafe_unretained PBDataReader
*reader
);