]> git.saurik.com Git - apple/security.git/blob - keychain/ot/proto/source/OTBottle.m
Security-58286.270.3.0.1.tar.gz
[apple/security.git] / keychain / ot / proto / source / OTBottle.m
1 // This file was automatically generated by protocompiler
2 // DO NOT EDIT!
3 // Compiled from OTBottle.proto
4
5 #import "OTBottle.h"
6 #import <ProtocolBuffer/PBConstants.h>
7 #import <ProtocolBuffer/PBHashUtil.h>
8 #import <ProtocolBuffer/PBDataReader.h>
9
10 #import "OTAuthenticatedCiphertext.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 OTBottle
17
18 - (BOOL)hasPeerID
19 {
20 return _peerID != nil;
21 }
22 @synthesize peerID = _peerID;
23 - (BOOL)hasSpID
24 {
25 return _spID != nil;
26 }
27 @synthesize spID = _spID;
28 - (BOOL)hasReserved3
29 {
30 return _reserved3 != nil;
31 }
32 @synthesize reserved3 = _reserved3;
33 - (BOOL)hasReserved4
34 {
35 return _reserved4 != nil;
36 }
37 @synthesize reserved4 = _reserved4;
38 - (BOOL)hasReserved5
39 {
40 return _reserved5 != nil;
41 }
42 @synthesize reserved5 = _reserved5;
43 - (BOOL)hasReserved6
44 {
45 return _reserved6 != nil;
46 }
47 @synthesize reserved6 = _reserved6;
48 - (BOOL)hasEscrowedSigningSPKI
49 {
50 return _escrowedSigningSPKI != nil;
51 }
52 @synthesize escrowedSigningSPKI = _escrowedSigningSPKI;
53 - (BOOL)hasEscrowedEncryptionSPKI
54 {
55 return _escrowedEncryptionSPKI != nil;
56 }
57 @synthesize escrowedEncryptionSPKI = _escrowedEncryptionSPKI;
58 - (BOOL)hasPeerSigningSPKI
59 {
60 return _peerSigningSPKI != nil;
61 }
62 @synthesize peerSigningSPKI = _peerSigningSPKI;
63 - (BOOL)hasPeerEncryptionSPKI
64 {
65 return _peerEncryptionSPKI != nil;
66 }
67 @synthesize peerEncryptionSPKI = _peerEncryptionSPKI;
68 - (BOOL)hasReserved7
69 {
70 return _reserved7 != nil;
71 }
72 @synthesize reserved7 = _reserved7;
73 - (BOOL)hasContents
74 {
75 return _contents != nil;
76 }
77 @synthesize contents = _contents;
78
79 - (NSString *)description
80 {
81 return [NSString stringWithFormat:@"%@ %@", [super description], [self dictionaryRepresentation]];
82 }
83
84 - (NSDictionary *)dictionaryRepresentation
85 {
86 NSMutableDictionary *dict = [NSMutableDictionary dictionary];
87 if (self->_peerID)
88 {
89 [dict setObject:self->_peerID forKey:@"peerID"];
90 }
91 if (self->_spID)
92 {
93 [dict setObject:self->_spID forKey:@"spID"];
94 }
95 if (self->_reserved3)
96 {
97 [dict setObject:self->_reserved3 forKey:@"reserved3"];
98 }
99 if (self->_reserved4)
100 {
101 [dict setObject:self->_reserved4 forKey:@"reserved4"];
102 }
103 if (self->_reserved5)
104 {
105 [dict setObject:self->_reserved5 forKey:@"reserved5"];
106 }
107 if (self->_reserved6)
108 {
109 [dict setObject:self->_reserved6 forKey:@"reserved6"];
110 }
111 if (self->_escrowedSigningSPKI)
112 {
113 [dict setObject:self->_escrowedSigningSPKI forKey:@"escrowedSigningSPKI"];
114 }
115 if (self->_escrowedEncryptionSPKI)
116 {
117 [dict setObject:self->_escrowedEncryptionSPKI forKey:@"escrowedEncryptionSPKI"];
118 }
119 if (self->_peerSigningSPKI)
120 {
121 [dict setObject:self->_peerSigningSPKI forKey:@"peerSigningSPKI"];
122 }
123 if (self->_peerEncryptionSPKI)
124 {
125 [dict setObject:self->_peerEncryptionSPKI forKey:@"peerEncryptionSPKI"];
126 }
127 if (self->_reserved7)
128 {
129 [dict setObject:self->_reserved7 forKey:@"reserved7"];
130 }
131 if (self->_contents)
132 {
133 [dict setObject:[_contents dictionaryRepresentation] forKey:@"contents"];
134 }
135 return dict;
136 }
137
138 BOOL OTBottleReadFrom(__unsafe_unretained OTBottle *self, __unsafe_unretained PBDataReader *reader) {
139 while (PBReaderHasMoreData(reader)) {
140 uint32_t tag = 0;
141 uint8_t aType = 0;
142
143 PBReaderReadTag32AndType(reader, &tag, &aType);
144
145 if (PBReaderHasError(reader))
146 break;
147
148 if (aType == TYPE_END_GROUP) {
149 break;
150 }
151
152 switch (tag) {
153
154 case 1 /* peerID */:
155 {
156 NSString *new_peerID = PBReaderReadString(reader);
157 self->_peerID = new_peerID;
158 }
159 break;
160 case 2 /* spID */:
161 {
162 NSString *new_spID = PBReaderReadString(reader);
163 self->_spID = new_spID;
164 }
165 break;
166 case 3 /* reserved3 */:
167 {
168 NSData *new_reserved3 = PBReaderReadData(reader);
169 self->_reserved3 = new_reserved3;
170 }
171 break;
172 case 4 /* reserved4 */:
173 {
174 NSData *new_reserved4 = PBReaderReadData(reader);
175 self->_reserved4 = new_reserved4;
176 }
177 break;
178 case 5 /* reserved5 */:
179 {
180 NSData *new_reserved5 = PBReaderReadData(reader);
181 self->_reserved5 = new_reserved5;
182 }
183 break;
184 case 6 /* reserved6 */:
185 {
186 NSData *new_reserved6 = PBReaderReadData(reader);
187 self->_reserved6 = new_reserved6;
188 }
189 break;
190 case 7 /* reserved7 */:
191 {
192 NSData *new_reserved7 = PBReaderReadData(reader);
193 self->_reserved7 = new_reserved7;
194 }
195 break;
196 case 8 /* escrowedSigningSPKI */:
197 {
198 NSData *new_escrowedSigningSPKI = PBReaderReadData(reader);
199 self->_escrowedSigningSPKI = new_escrowedSigningSPKI;
200 }
201 break;
202 case 9 /* escrowedEncryptionSPKI */:
203 {
204 NSData *new_escrowedEncryptionSPKI = PBReaderReadData(reader);
205 self->_escrowedEncryptionSPKI = new_escrowedEncryptionSPKI;
206 }
207 break;
208 case 10 /* peerSigningSPKI */:
209 {
210 NSData *new_peerSigningSPKI = PBReaderReadData(reader);
211 self->_peerSigningSPKI = new_peerSigningSPKI;
212 }
213 break;
214 case 11 /* peerEncryptionSPKI */:
215 {
216 NSData *new_peerEncryptionSPKI = PBReaderReadData(reader);
217 self->_peerEncryptionSPKI = new_peerEncryptionSPKI;
218 }
219 break;
220 case 12 /* contents */:
221 {
222 OTAuthenticatedCiphertext *new_contents = [[OTAuthenticatedCiphertext alloc] init];
223 self->_contents = new_contents;
224 PBDataReaderMark mark_contents;
225 BOOL markError = !PBReaderPlaceMark(reader, &mark_contents);
226 if (markError)
227 {
228 return NO;
229 }
230 BOOL inError = !OTAuthenticatedCiphertextReadFrom(new_contents, reader);
231 if (inError)
232 {
233 return NO;
234 }
235 PBReaderRecallMark(reader, &mark_contents);
236 }
237 break;
238 default:
239 if (!PBReaderSkipValueWithTag(reader, tag, aType))
240 return NO;
241 break;
242 }
243 }
244 return !PBReaderHasError(reader);
245 }
246
247 - (BOOL)readFrom:(PBDataReader *)reader
248 {
249 return OTBottleReadFrom(self, reader);
250 }
251 - (void)writeTo:(PBDataWriter *)writer
252 {
253 /* peerID */
254 {
255 if (self->_peerID)
256 {
257 PBDataWriterWriteStringField(writer, self->_peerID, 1);
258 }
259 }
260 /* spID */
261 {
262 if (self->_spID)
263 {
264 PBDataWriterWriteStringField(writer, self->_spID, 2);
265 }
266 }
267 /* reserved3 */
268 {
269 if (self->_reserved3)
270 {
271 PBDataWriterWriteDataField(writer, self->_reserved3, 3);
272 }
273 }
274 /* reserved4 */
275 {
276 if (self->_reserved4)
277 {
278 PBDataWriterWriteDataField(writer, self->_reserved4, 4);
279 }
280 }
281 /* reserved5 */
282 {
283 if (self->_reserved5)
284 {
285 PBDataWriterWriteDataField(writer, self->_reserved5, 5);
286 }
287 }
288 /* reserved6 */
289 {
290 if (self->_reserved6)
291 {
292 PBDataWriterWriteDataField(writer, self->_reserved6, 6);
293 }
294 }
295 /* reserved7 */
296 {
297 if (self->_reserved7)
298 {
299 PBDataWriterWriteDataField(writer, self->_reserved7, 7);
300 }
301 }
302 /* escrowedSigningSPKI */
303 {
304 if (self->_escrowedSigningSPKI)
305 {
306 PBDataWriterWriteDataField(writer, self->_escrowedSigningSPKI, 8);
307 }
308 }
309 /* escrowedEncryptionSPKI */
310 {
311 if (self->_escrowedEncryptionSPKI)
312 {
313 PBDataWriterWriteDataField(writer, self->_escrowedEncryptionSPKI, 9);
314 }
315 }
316 /* peerSigningSPKI */
317 {
318 if (self->_peerSigningSPKI)
319 {
320 PBDataWriterWriteDataField(writer, self->_peerSigningSPKI, 10);
321 }
322 }
323 /* peerEncryptionSPKI */
324 {
325 if (self->_peerEncryptionSPKI)
326 {
327 PBDataWriterWriteDataField(writer, self->_peerEncryptionSPKI, 11);
328 }
329 }
330 /* contents */
331 {
332 if (self->_contents != nil)
333 {
334 PBDataWriterWriteSubmessage(writer, self->_contents, 12);
335 }
336 }
337 }
338
339 - (void)copyTo:(OTBottle *)other
340 {
341 if (_peerID)
342 {
343 other.peerID = _peerID;
344 }
345 if (_spID)
346 {
347 other.spID = _spID;
348 }
349 if (_reserved3)
350 {
351 other.reserved3 = _reserved3;
352 }
353 if (_reserved4)
354 {
355 other.reserved4 = _reserved4;
356 }
357 if (_reserved5)
358 {
359 other.reserved5 = _reserved5;
360 }
361 if (_reserved6)
362 {
363 other.reserved6 = _reserved6;
364 }
365 if (_reserved7)
366 {
367 other.reserved7 = _reserved7;
368 }
369 if (_escrowedSigningSPKI)
370 {
371 other.escrowedSigningSPKI = _escrowedSigningSPKI;
372 }
373 if (_escrowedEncryptionSPKI)
374 {
375 other.escrowedEncryptionSPKI = _escrowedEncryptionSPKI;
376 }
377 if (_peerSigningSPKI)
378 {
379 other.peerSigningSPKI = _peerSigningSPKI;
380 }
381 if (_peerEncryptionSPKI)
382 {
383 other.peerEncryptionSPKI = _peerEncryptionSPKI;
384 }
385 if (_contents)
386 {
387 other.contents = _contents;
388 }
389 }
390
391 - (id)copyWithZone:(NSZone *)zone
392 {
393 OTBottle *copy = [[[self class] allocWithZone:zone] init];
394 copy->_peerID = [_peerID copyWithZone:zone];
395 copy->_spID = [_spID copyWithZone:zone];
396 copy->_reserved3 = [_reserved3 copyWithZone:zone];
397 copy->_reserved4 = [_reserved4 copyWithZone:zone];
398 copy->_reserved5 = [_reserved5 copyWithZone:zone];
399 copy->_reserved6 = [_reserved6 copyWithZone:zone];
400 copy->_reserved7 = [_reserved7 copyWithZone:zone];
401 copy->_escrowedSigningSPKI = [_escrowedSigningSPKI copyWithZone:zone];
402 copy->_escrowedEncryptionSPKI = [_escrowedEncryptionSPKI copyWithZone:zone];
403 copy->_peerSigningSPKI = [_peerSigningSPKI copyWithZone:zone];
404 copy->_peerEncryptionSPKI = [_peerEncryptionSPKI copyWithZone:zone];
405 copy->_contents = [_contents copyWithZone:zone];
406 return copy;
407 }
408
409 - (BOOL)isEqual:(id)object
410 {
411 OTBottle *other = (OTBottle *)object;
412 return [other isMemberOfClass:[self class]]
413 &&
414 ((!self->_peerID && !other->_peerID) || [self->_peerID isEqual:other->_peerID])
415 &&
416 ((!self->_spID && !other->_spID) || [self->_spID isEqual:other->_spID])
417 &&
418 ((!self->_reserved3 && !other->_reserved3) || [self->_reserved3 isEqual:other->_reserved3])
419 &&
420 ((!self->_reserved4 && !other->_reserved4) || [self->_reserved4 isEqual:other->_reserved4])
421 &&
422 ((!self->_reserved5 && !other->_reserved5) || [self->_reserved5 isEqual:other->_reserved5])
423 &&
424 ((!self->_reserved6 && !other->_reserved6) || [self->_reserved6 isEqual:other->_reserved6])
425 &&
426 ((!self->_reserved7 && !other->_reserved7) || [self->_reserved7 isEqual:other->_reserved7])
427 &&
428 ((!self->_escrowedSigningSPKI && !other->_escrowedSigningSPKI) || [self->_escrowedSigningSPKI isEqual:other->_escrowedSigningSPKI])
429 &&
430 ((!self->_escrowedEncryptionSPKI && !other->_escrowedEncryptionSPKI) || [self->_escrowedEncryptionSPKI isEqual:other->_escrowedEncryptionSPKI])
431 &&
432 ((!self->_peerSigningSPKI && !other->_peerSigningSPKI) || [self->_peerSigningSPKI isEqual:other->_peerSigningSPKI])
433 &&
434 ((!self->_peerEncryptionSPKI && !other->_peerEncryptionSPKI) || [self->_peerEncryptionSPKI isEqual:other->_peerEncryptionSPKI])
435 &&
436 ((!self->_contents && !other->_contents) || [self->_contents isEqual:other->_contents])
437 ;
438 }
439
440 - (NSUInteger)hash
441 {
442 return 0
443 ^
444 [self->_peerID hash]
445 ^
446 [self->_spID hash]
447 ^
448 [self->_reserved3 hash]
449 ^
450 [self->_reserved4 hash]
451 ^
452 [self->_reserved5 hash]
453 ^
454 [self->_reserved6 hash]
455 ^
456 [self->_reserved7 hash]
457 ^
458 [self->_escrowedSigningSPKI hash]
459 ^
460 [self->_escrowedEncryptionSPKI hash]
461 ^
462 [self->_peerSigningSPKI hash]
463 ^
464 [self->_peerEncryptionSPKI hash]
465 ^
466 [self->_contents hash]
467 ;
468 }
469
470 - (void)mergeFrom:(OTBottle *)other
471 {
472 if (other->_peerID)
473 {
474 [self setPeerID:other->_peerID];
475 }
476 if (other->_spID)
477 {
478 [self setSpID:other->_spID];
479 }
480 if (other->_reserved3)
481 {
482 [self setReserved3:other->_reserved3];
483 }
484 if (other->_reserved4)
485 {
486 [self setReserved4:other->_reserved4];
487 }
488 if (other->_reserved5)
489 {
490 [self setReserved5:other->_reserved5];
491 }
492 if (other->_reserved6)
493 {
494 [self setReserved6:other->_reserved6];
495 }
496 if (other->_reserved7)
497 {
498 [self setReserved7:other->_reserved7];
499 }
500 if (other->_escrowedSigningSPKI)
501 {
502 [self setEscrowedSigningSPKI:other->_escrowedSigningSPKI];
503 }
504 if (other->_escrowedEncryptionSPKI)
505 {
506 [self setEscrowedEncryptionSPKI:other->_escrowedEncryptionSPKI];
507 }
508 if (other->_peerSigningSPKI)
509 {
510 [self setPeerSigningSPKI:other->_peerSigningSPKI];
511 }
512 if (other->_peerEncryptionSPKI)
513 {
514 [self setPeerEncryptionSPKI:other->_peerEncryptionSPKI];
515 }
516 if (self->_contents && other->_contents)
517 {
518 [self->_contents mergeFrom:other->_contents];
519 }
520 else if (!self->_contents && other->_contents)
521 {
522 [self setContents:other->_contents];
523 }
524 }
525
526 @end
527