]> git.saurik.com Git - apple/security.git/blob - keychain/ot/proto/generated_source/OTEscrowRecordMetadata.m
Security-59754.41.1.tar.gz
[apple/security.git] / keychain / ot / proto / generated_source / OTEscrowRecordMetadata.m
1 // This file was automatically generated by protocompiler
2 // DO NOT EDIT!
3 // Compiled from OTEscrowRecord.proto
4
5 #import "OTEscrowRecordMetadata.h"
6 #import <ProtocolBuffer/PBConstants.h>
7 #import <ProtocolBuffer/PBHashUtil.h>
8 #import <ProtocolBuffer/PBDataReader.h>
9
10 #import "OTEscrowRecordMetadataClientMetadata.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 OTEscrowRecordMetadata
17
18 - (BOOL)hasBackupKeybagDigest
19 {
20 return _backupKeybagDigest != nil;
21 }
22 @synthesize backupKeybagDigest = _backupKeybagDigest;
23 - (BOOL)hasClientMetadata
24 {
25 return _clientMetadata != nil;
26 }
27 @synthesize clientMetadata = _clientMetadata;
28 @synthesize secureBackupUsesMultipleIcscs = _secureBackupUsesMultipleIcscs;
29 - (void)setSecureBackupUsesMultipleIcscs:(uint64_t)v
30 {
31 _has.secureBackupUsesMultipleIcscs = YES;
32 _secureBackupUsesMultipleIcscs = v;
33 }
34 - (void)setHasSecureBackupUsesMultipleIcscs:(BOOL)f
35 {
36 _has.secureBackupUsesMultipleIcscs = f;
37 }
38 - (BOOL)hasSecureBackupUsesMultipleIcscs
39 {
40 return _has.secureBackupUsesMultipleIcscs != 0;
41 }
42 - (BOOL)hasBottleId
43 {
44 return _bottleId != nil;
45 }
46 @synthesize bottleId = _bottleId;
47 @synthesize secureBackupTimestamp = _secureBackupTimestamp;
48 - (void)setSecureBackupTimestamp:(uint64_t)v
49 {
50 _has.secureBackupTimestamp = YES;
51 _secureBackupTimestamp = v;
52 }
53 - (void)setHasSecureBackupTimestamp:(BOOL)f
54 {
55 _has.secureBackupTimestamp = f;
56 }
57 - (BOOL)hasSecureBackupTimestamp
58 {
59 return _has.secureBackupTimestamp != 0;
60 }
61 - (BOOL)hasEscrowedSpki
62 {
63 return _escrowedSpki != nil;
64 }
65 @synthesize escrowedSpki = _escrowedSpki;
66 - (BOOL)hasPeerInfo
67 {
68 return _peerInfo != nil;
69 }
70 @synthesize peerInfo = _peerInfo;
71 - (BOOL)hasBottleValidity
72 {
73 return _bottleValidity != nil;
74 }
75 @synthesize bottleValidity = _bottleValidity;
76 - (BOOL)hasSerial
77 {
78 return _serial != nil;
79 }
80 @synthesize serial = _serial;
81
82 - (NSString *)description
83 {
84 return [NSString stringWithFormat:@"%@ %@", [super description], [self dictionaryRepresentation]];
85 }
86
87 - (NSDictionary *)dictionaryRepresentation
88 {
89 NSMutableDictionary *dict = [NSMutableDictionary dictionary];
90 if (self->_backupKeybagDigest)
91 {
92 [dict setObject:self->_backupKeybagDigest forKey:@"backup_keybag_digest"];
93 }
94 if (self->_clientMetadata)
95 {
96 [dict setObject:[_clientMetadata dictionaryRepresentation] forKey:@"client_metadata"];
97 }
98 if (self->_has.secureBackupUsesMultipleIcscs)
99 {
100 [dict setObject:[NSNumber numberWithUnsignedLongLong:self->_secureBackupUsesMultipleIcscs] forKey:@"secure_backup_uses_multiple_icscs"];
101 }
102 if (self->_bottleId)
103 {
104 [dict setObject:self->_bottleId forKey:@"bottle_id"];
105 }
106 if (self->_has.secureBackupTimestamp)
107 {
108 [dict setObject:[NSNumber numberWithUnsignedLongLong:self->_secureBackupTimestamp] forKey:@"secure_backup_timestamp"];
109 }
110 if (self->_escrowedSpki)
111 {
112 [dict setObject:self->_escrowedSpki forKey:@"escrowed_spki"];
113 }
114 if (self->_peerInfo)
115 {
116 [dict setObject:self->_peerInfo forKey:@"peer_info"];
117 }
118 if (self->_bottleValidity)
119 {
120 [dict setObject:self->_bottleValidity forKey:@"bottle_validity"];
121 }
122 if (self->_serial)
123 {
124 [dict setObject:self->_serial forKey:@"serial"];
125 }
126 return dict;
127 }
128
129 BOOL OTEscrowRecordMetadataReadFrom(__unsafe_unretained OTEscrowRecordMetadata *self, __unsafe_unretained PBDataReader *reader) {
130 while (PBReaderHasMoreData(reader)) {
131 uint32_t tag = 0;
132 uint8_t aType = 0;
133
134 PBReaderReadTag32AndType(reader, &tag, &aType);
135
136 if (PBReaderHasError(reader))
137 break;
138
139 if (aType == TYPE_END_GROUP) {
140 break;
141 }
142
143 switch (tag) {
144
145 case 1 /* backupKeybagDigest */:
146 {
147 NSData *new_backupKeybagDigest = PBReaderReadData(reader);
148 self->_backupKeybagDigest = new_backupKeybagDigest;
149 }
150 break;
151 case 2 /* clientMetadata */:
152 {
153 OTEscrowRecordMetadataClientMetadata *new_clientMetadata = [[OTEscrowRecordMetadataClientMetadata alloc] init];
154 self->_clientMetadata = new_clientMetadata;
155 PBDataReaderMark mark_clientMetadata;
156 BOOL markError = !PBReaderPlaceMark(reader, &mark_clientMetadata);
157 if (markError)
158 {
159 return NO;
160 }
161 BOOL inError = !OTEscrowRecordMetadataClientMetadataReadFrom(new_clientMetadata, reader);
162 if (inError)
163 {
164 return NO;
165 }
166 PBReaderRecallMark(reader, &mark_clientMetadata);
167 }
168 break;
169 case 3 /* secureBackupUsesMultipleIcscs */:
170 {
171 self->_has.secureBackupUsesMultipleIcscs = YES;
172 self->_secureBackupUsesMultipleIcscs = PBReaderReadUint64(reader);
173 }
174 break;
175 case 4 /* bottleId */:
176 {
177 NSString *new_bottleId = PBReaderReadString(reader);
178 self->_bottleId = new_bottleId;
179 }
180 break;
181 case 5 /* secureBackupTimestamp */:
182 {
183 self->_has.secureBackupTimestamp = YES;
184 self->_secureBackupTimestamp = PBReaderReadUint64(reader);
185 }
186 break;
187 case 6 /* escrowedSpki */:
188 {
189 NSData *new_escrowedSpki = PBReaderReadData(reader);
190 self->_escrowedSpki = new_escrowedSpki;
191 }
192 break;
193 case 7 /* peerInfo */:
194 {
195 NSData *new_peerInfo = PBReaderReadData(reader);
196 self->_peerInfo = new_peerInfo;
197 }
198 break;
199 case 8 /* bottleValidity */:
200 {
201 NSString *new_bottleValidity = PBReaderReadString(reader);
202 self->_bottleValidity = new_bottleValidity;
203 }
204 break;
205 case 9 /* serial */:
206 {
207 NSString *new_serial = PBReaderReadString(reader);
208 self->_serial = new_serial;
209 }
210 break;
211 default:
212 if (!PBReaderSkipValueWithTag(reader, tag, aType))
213 return NO;
214 break;
215 }
216 }
217 return !PBReaderHasError(reader);
218 }
219
220 - (BOOL)readFrom:(PBDataReader *)reader
221 {
222 return OTEscrowRecordMetadataReadFrom(self, reader);
223 }
224 - (void)writeTo:(PBDataWriter *)writer
225 {
226 /* backupKeybagDigest */
227 {
228 if (self->_backupKeybagDigest)
229 {
230 PBDataWriterWriteDataField(writer, self->_backupKeybagDigest, 1);
231 }
232 }
233 /* clientMetadata */
234 {
235 if (self->_clientMetadata != nil)
236 {
237 PBDataWriterWriteSubmessage(writer, self->_clientMetadata, 2);
238 }
239 }
240 /* secureBackupUsesMultipleIcscs */
241 {
242 if (self->_has.secureBackupUsesMultipleIcscs)
243 {
244 PBDataWriterWriteUint64Field(writer, self->_secureBackupUsesMultipleIcscs, 3);
245 }
246 }
247 /* bottleId */
248 {
249 if (self->_bottleId)
250 {
251 PBDataWriterWriteStringField(writer, self->_bottleId, 4);
252 }
253 }
254 /* secureBackupTimestamp */
255 {
256 if (self->_has.secureBackupTimestamp)
257 {
258 PBDataWriterWriteUint64Field(writer, self->_secureBackupTimestamp, 5);
259 }
260 }
261 /* escrowedSpki */
262 {
263 if (self->_escrowedSpki)
264 {
265 PBDataWriterWriteDataField(writer, self->_escrowedSpki, 6);
266 }
267 }
268 /* peerInfo */
269 {
270 if (self->_peerInfo)
271 {
272 PBDataWriterWriteDataField(writer, self->_peerInfo, 7);
273 }
274 }
275 /* bottleValidity */
276 {
277 if (self->_bottleValidity)
278 {
279 PBDataWriterWriteStringField(writer, self->_bottleValidity, 8);
280 }
281 }
282 /* serial */
283 {
284 if (self->_serial)
285 {
286 PBDataWriterWriteStringField(writer, self->_serial, 9);
287 }
288 }
289 }
290
291 - (void)copyTo:(OTEscrowRecordMetadata *)other
292 {
293 if (_backupKeybagDigest)
294 {
295 other.backupKeybagDigest = _backupKeybagDigest;
296 }
297 if (_clientMetadata)
298 {
299 other.clientMetadata = _clientMetadata;
300 }
301 if (self->_has.secureBackupUsesMultipleIcscs)
302 {
303 other->_secureBackupUsesMultipleIcscs = _secureBackupUsesMultipleIcscs;
304 other->_has.secureBackupUsesMultipleIcscs = YES;
305 }
306 if (_bottleId)
307 {
308 other.bottleId = _bottleId;
309 }
310 if (self->_has.secureBackupTimestamp)
311 {
312 other->_secureBackupTimestamp = _secureBackupTimestamp;
313 other->_has.secureBackupTimestamp = YES;
314 }
315 if (_escrowedSpki)
316 {
317 other.escrowedSpki = _escrowedSpki;
318 }
319 if (_peerInfo)
320 {
321 other.peerInfo = _peerInfo;
322 }
323 if (_bottleValidity)
324 {
325 other.bottleValidity = _bottleValidity;
326 }
327 if (_serial)
328 {
329 other.serial = _serial;
330 }
331 }
332
333 - (id)copyWithZone:(NSZone *)zone
334 {
335 OTEscrowRecordMetadata *copy = [[[self class] allocWithZone:zone] init];
336 copy->_backupKeybagDigest = [_backupKeybagDigest copyWithZone:zone];
337 copy->_clientMetadata = [_clientMetadata copyWithZone:zone];
338 if (self->_has.secureBackupUsesMultipleIcscs)
339 {
340 copy->_secureBackupUsesMultipleIcscs = _secureBackupUsesMultipleIcscs;
341 copy->_has.secureBackupUsesMultipleIcscs = YES;
342 }
343 copy->_bottleId = [_bottleId copyWithZone:zone];
344 if (self->_has.secureBackupTimestamp)
345 {
346 copy->_secureBackupTimestamp = _secureBackupTimestamp;
347 copy->_has.secureBackupTimestamp = YES;
348 }
349 copy->_escrowedSpki = [_escrowedSpki copyWithZone:zone];
350 copy->_peerInfo = [_peerInfo copyWithZone:zone];
351 copy->_bottleValidity = [_bottleValidity copyWithZone:zone];
352 copy->_serial = [_serial copyWithZone:zone];
353 return copy;
354 }
355
356 - (BOOL)isEqual:(id)object
357 {
358 OTEscrowRecordMetadata *other = (OTEscrowRecordMetadata *)object;
359 return [other isMemberOfClass:[self class]]
360 &&
361 ((!self->_backupKeybagDigest && !other->_backupKeybagDigest) || [self->_backupKeybagDigest isEqual:other->_backupKeybagDigest])
362 &&
363 ((!self->_clientMetadata && !other->_clientMetadata) || [self->_clientMetadata isEqual:other->_clientMetadata])
364 &&
365 ((self->_has.secureBackupUsesMultipleIcscs && other->_has.secureBackupUsesMultipleIcscs && self->_secureBackupUsesMultipleIcscs == other->_secureBackupUsesMultipleIcscs) || (!self->_has.secureBackupUsesMultipleIcscs && !other->_has.secureBackupUsesMultipleIcscs))
366 &&
367 ((!self->_bottleId && !other->_bottleId) || [self->_bottleId isEqual:other->_bottleId])
368 &&
369 ((self->_has.secureBackupTimestamp && other->_has.secureBackupTimestamp && self->_secureBackupTimestamp == other->_secureBackupTimestamp) || (!self->_has.secureBackupTimestamp && !other->_has.secureBackupTimestamp))
370 &&
371 ((!self->_escrowedSpki && !other->_escrowedSpki) || [self->_escrowedSpki isEqual:other->_escrowedSpki])
372 &&
373 ((!self->_peerInfo && !other->_peerInfo) || [self->_peerInfo isEqual:other->_peerInfo])
374 &&
375 ((!self->_bottleValidity && !other->_bottleValidity) || [self->_bottleValidity isEqual:other->_bottleValidity])
376 &&
377 ((!self->_serial && !other->_serial) || [self->_serial isEqual:other->_serial])
378 ;
379 }
380
381 - (NSUInteger)hash
382 {
383 return 0
384 ^
385 [self->_backupKeybagDigest hash]
386 ^
387 [self->_clientMetadata hash]
388 ^
389 (self->_has.secureBackupUsesMultipleIcscs ? PBHashInt((NSUInteger)self->_secureBackupUsesMultipleIcscs) : 0)
390 ^
391 [self->_bottleId hash]
392 ^
393 (self->_has.secureBackupTimestamp ? PBHashInt((NSUInteger)self->_secureBackupTimestamp) : 0)
394 ^
395 [self->_escrowedSpki hash]
396 ^
397 [self->_peerInfo hash]
398 ^
399 [self->_bottleValidity hash]
400 ^
401 [self->_serial hash]
402 ;
403 }
404
405 - (void)mergeFrom:(OTEscrowRecordMetadata *)other
406 {
407 if (other->_backupKeybagDigest)
408 {
409 [self setBackupKeybagDigest:other->_backupKeybagDigest];
410 }
411 if (self->_clientMetadata && other->_clientMetadata)
412 {
413 [self->_clientMetadata mergeFrom:other->_clientMetadata];
414 }
415 else if (!self->_clientMetadata && other->_clientMetadata)
416 {
417 [self setClientMetadata:other->_clientMetadata];
418 }
419 if (other->_has.secureBackupUsesMultipleIcscs)
420 {
421 self->_secureBackupUsesMultipleIcscs = other->_secureBackupUsesMultipleIcscs;
422 self->_has.secureBackupUsesMultipleIcscs = YES;
423 }
424 if (other->_bottleId)
425 {
426 [self setBottleId:other->_bottleId];
427 }
428 if (other->_has.secureBackupTimestamp)
429 {
430 self->_secureBackupTimestamp = other->_secureBackupTimestamp;
431 self->_has.secureBackupTimestamp = YES;
432 }
433 if (other->_escrowedSpki)
434 {
435 [self setEscrowedSpki:other->_escrowedSpki];
436 }
437 if (other->_peerInfo)
438 {
439 [self setPeerInfo:other->_peerInfo];
440 }
441 if (other->_bottleValidity)
442 {
443 [self setBottleValidity:other->_bottleValidity];
444 }
445 if (other->_serial)
446 {
447 [self setSerial:other->_serial];
448 }
449 }
450
451 @end
452