]> git.saurik.com Git - apple/security.git/blob - OSX/sec/securityd/SecDbBackupManager-protobufs/generated_source/SecDbBackupRecoverySet.m
Security-59306.11.20.tar.gz
[apple/security.git] / OSX / sec / securityd / SecDbBackupManager-protobufs / generated_source / SecDbBackupRecoverySet.m
1 // This file was automatically generated by protocompiler
2 // DO NOT EDIT!
3 // Compiled from SecDbBackupRecoverySet.proto
4
5 #import "SecDbBackupRecoverySet.h"
6 #import <ProtocolBuffer/PBConstants.h>
7 #import <ProtocolBuffer/PBHashUtil.h>
8 #import <ProtocolBuffer/PBDataReader.h>
9
10 #import "SecDbBackupBagIdentity.h"
11
12 #if !__has_feature(objc_arc)
13 # error This generated file depends on ARC but it is not enabled; turn on ARC, or use 'objc_use_arc' option to generate non-ARC code.
14 #endif
15
16 @implementation SecDbBackupRecoverySet
17
18 @synthesize recoveryType = _recoveryType;
19 - (void)setRecoveryType:(int32_t)v
20 {
21 _has.recoveryType = YES;
22 _recoveryType = v;
23 }
24 - (void)setHasRecoveryType:(BOOL)f
25 {
26 _has.recoveryType = f;
27 }
28 - (BOOL)hasRecoveryType
29 {
30 return _has.recoveryType;
31 }
32 - (BOOL)hasBagIdentity
33 {
34 return _bagIdentity != nil;
35 }
36 @synthesize bagIdentity = _bagIdentity;
37 - (BOOL)hasWrappedBagSecret
38 {
39 return _wrappedBagSecret != nil;
40 }
41 @synthesize wrappedBagSecret = _wrappedBagSecret;
42 - (BOOL)hasWrappedKCSKSecret
43 {
44 return _wrappedKCSKSecret != nil;
45 }
46 @synthesize wrappedKCSKSecret = _wrappedKCSKSecret;
47 - (BOOL)hasWrappedRecoveryKey
48 {
49 return _wrappedRecoveryKey != nil;
50 }
51 @synthesize wrappedRecoveryKey = _wrappedRecoveryKey;
52
53 - (NSString *)description
54 {
55 return [NSString stringWithFormat:@"%@ %@", [super description], [self dictionaryRepresentation]];
56 }
57
58 - (NSDictionary *)dictionaryRepresentation
59 {
60 NSMutableDictionary *dict = [NSMutableDictionary dictionary];
61 if (self->_has.recoveryType)
62 {
63 [dict setObject:[NSNumber numberWithInt:self->_recoveryType] forKey:@"recoveryType"];
64 }
65 if (self->_bagIdentity)
66 {
67 [dict setObject:[_bagIdentity dictionaryRepresentation] forKey:@"bagIdentity"];
68 }
69 if (self->_wrappedBagSecret)
70 {
71 [dict setObject:self->_wrappedBagSecret forKey:@"wrappedBagSecret"];
72 }
73 if (self->_wrappedKCSKSecret)
74 {
75 [dict setObject:self->_wrappedKCSKSecret forKey:@"wrappedKCSKSecret"];
76 }
77 if (self->_wrappedRecoveryKey)
78 {
79 [dict setObject:self->_wrappedRecoveryKey forKey:@"wrappedRecoveryKey"];
80 }
81 return dict;
82 }
83
84 BOOL SecDbBackupRecoverySetReadFrom(__unsafe_unretained SecDbBackupRecoverySet *self, __unsafe_unretained PBDataReader *reader) {
85 while (PBReaderHasMoreData(reader)) {
86 uint32_t tag = 0;
87 uint8_t aType = 0;
88
89 PBReaderReadTag32AndType(reader, &tag, &aType);
90
91 if (PBReaderHasError(reader))
92 break;
93
94 if (aType == TYPE_END_GROUP) {
95 break;
96 }
97
98 switch (tag) {
99
100 case 1 /* recoveryType */:
101 {
102 self->_has.recoveryType = YES;
103 self->_recoveryType = PBReaderReadInt32(reader);
104 }
105 break;
106 case 2 /* bagIdentity */:
107 {
108 SecDbBackupBagIdentity *new_bagIdentity = [[SecDbBackupBagIdentity alloc] init];
109 self->_bagIdentity = new_bagIdentity;
110 PBDataReaderMark mark_bagIdentity;
111 BOOL markError = !PBReaderPlaceMark(reader, &mark_bagIdentity);
112 if (markError)
113 {
114 return NO;
115 }
116 BOOL inError = !SecDbBackupBagIdentityReadFrom(new_bagIdentity, reader);
117 if (inError)
118 {
119 return NO;
120 }
121 PBReaderRecallMark(reader, &mark_bagIdentity);
122 }
123 break;
124 case 3 /* wrappedBagSecret */:
125 {
126 NSData *new_wrappedBagSecret = PBReaderReadData(reader);
127 self->_wrappedBagSecret = new_wrappedBagSecret;
128 }
129 break;
130 case 4 /* wrappedKCSKSecret */:
131 {
132 NSData *new_wrappedKCSKSecret = PBReaderReadData(reader);
133 self->_wrappedKCSKSecret = new_wrappedKCSKSecret;
134 }
135 break;
136 case 5 /* wrappedRecoveryKey */:
137 {
138 NSData *new_wrappedRecoveryKey = PBReaderReadData(reader);
139 self->_wrappedRecoveryKey = new_wrappedRecoveryKey;
140 }
141 break;
142 default:
143 if (!PBReaderSkipValueWithTag(reader, tag, aType))
144 return NO;
145 break;
146 }
147 }
148 return !PBReaderHasError(reader);
149 }
150
151 - (BOOL)readFrom:(PBDataReader *)reader
152 {
153 return SecDbBackupRecoverySetReadFrom(self, reader);
154 }
155 - (void)writeTo:(PBDataWriter *)writer
156 {
157 /* recoveryType */
158 {
159 if (self->_has.recoveryType)
160 {
161 PBDataWriterWriteInt32Field(writer, self->_recoveryType, 1);
162 }
163 }
164 /* bagIdentity */
165 {
166 if (self->_bagIdentity != nil)
167 {
168 PBDataWriterWriteSubmessage(writer, self->_bagIdentity, 2);
169 }
170 }
171 /* wrappedBagSecret */
172 {
173 if (self->_wrappedBagSecret)
174 {
175 PBDataWriterWriteDataField(writer, self->_wrappedBagSecret, 3);
176 }
177 }
178 /* wrappedKCSKSecret */
179 {
180 if (self->_wrappedKCSKSecret)
181 {
182 PBDataWriterWriteDataField(writer, self->_wrappedKCSKSecret, 4);
183 }
184 }
185 /* wrappedRecoveryKey */
186 {
187 if (self->_wrappedRecoveryKey)
188 {
189 PBDataWriterWriteDataField(writer, self->_wrappedRecoveryKey, 5);
190 }
191 }
192 }
193
194 - (void)copyTo:(SecDbBackupRecoverySet *)other
195 {
196 if (self->_has.recoveryType)
197 {
198 other->_recoveryType = _recoveryType;
199 other->_has.recoveryType = YES;
200 }
201 if (_bagIdentity)
202 {
203 other.bagIdentity = _bagIdentity;
204 }
205 if (_wrappedBagSecret)
206 {
207 other.wrappedBagSecret = _wrappedBagSecret;
208 }
209 if (_wrappedKCSKSecret)
210 {
211 other.wrappedKCSKSecret = _wrappedKCSKSecret;
212 }
213 if (_wrappedRecoveryKey)
214 {
215 other.wrappedRecoveryKey = _wrappedRecoveryKey;
216 }
217 }
218
219 - (id)copyWithZone:(NSZone *)zone
220 {
221 SecDbBackupRecoverySet *copy = [[[self class] allocWithZone:zone] init];
222 if (self->_has.recoveryType)
223 {
224 copy->_recoveryType = _recoveryType;
225 copy->_has.recoveryType = YES;
226 }
227 copy->_bagIdentity = [_bagIdentity copyWithZone:zone];
228 copy->_wrappedBagSecret = [_wrappedBagSecret copyWithZone:zone];
229 copy->_wrappedKCSKSecret = [_wrappedKCSKSecret copyWithZone:zone];
230 copy->_wrappedRecoveryKey = [_wrappedRecoveryKey copyWithZone:zone];
231 return copy;
232 }
233
234 - (BOOL)isEqual:(id)object
235 {
236 SecDbBackupRecoverySet *other = (SecDbBackupRecoverySet *)object;
237 return [other isMemberOfClass:[self class]]
238 &&
239 ((self->_has.recoveryType && other->_has.recoveryType && self->_recoveryType == other->_recoveryType) || (!self->_has.recoveryType && !other->_has.recoveryType))
240 &&
241 ((!self->_bagIdentity && !other->_bagIdentity) || [self->_bagIdentity isEqual:other->_bagIdentity])
242 &&
243 ((!self->_wrappedBagSecret && !other->_wrappedBagSecret) || [self->_wrappedBagSecret isEqual:other->_wrappedBagSecret])
244 &&
245 ((!self->_wrappedKCSKSecret && !other->_wrappedKCSKSecret) || [self->_wrappedKCSKSecret isEqual:other->_wrappedKCSKSecret])
246 &&
247 ((!self->_wrappedRecoveryKey && !other->_wrappedRecoveryKey) || [self->_wrappedRecoveryKey isEqual:other->_wrappedRecoveryKey])
248 ;
249 }
250
251 - (NSUInteger)hash
252 {
253 return 0
254 ^
255 (self->_has.recoveryType ? PBHashInt((NSUInteger)self->_recoveryType) : 0)
256 ^
257 [self->_bagIdentity hash]
258 ^
259 [self->_wrappedBagSecret hash]
260 ^
261 [self->_wrappedKCSKSecret hash]
262 ^
263 [self->_wrappedRecoveryKey hash]
264 ;
265 }
266
267 - (void)mergeFrom:(SecDbBackupRecoverySet *)other
268 {
269 if (other->_has.recoveryType)
270 {
271 self->_recoveryType = other->_recoveryType;
272 self->_has.recoveryType = YES;
273 }
274 if (self->_bagIdentity && other->_bagIdentity)
275 {
276 [self->_bagIdentity mergeFrom:other->_bagIdentity];
277 }
278 else if (!self->_bagIdentity && other->_bagIdentity)
279 {
280 [self setBagIdentity:other->_bagIdentity];
281 }
282 if (other->_wrappedBagSecret)
283 {
284 [self setWrappedBagSecret:other->_wrappedBagSecret];
285 }
286 if (other->_wrappedKCSKSecret)
287 {
288 [self setWrappedKCSKSecret:other->_wrappedKCSKSecret];
289 }
290 if (other->_wrappedRecoveryKey)
291 {
292 [self setWrappedRecoveryKey:other->_wrappedRecoveryKey];
293 }
294 }
295
296 @end
297