1 // This file was automatically generated by protocompiler
3 // Compiled from OTBottle.proto
6 #import <ProtocolBuffer/PBConstants.h>
7 #import <ProtocolBuffer/PBHashUtil.h>
8 #import <ProtocolBuffer/PBDataReader.h>
10 #import "OTAuthenticatedCiphertext.h"
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.
16 @implementation OTBottle
20 return _peerID != nil;
22 @synthesize peerID = _peerID;
27 @synthesize spID = _spID;
30 return _reserved3 != nil;
32 @synthesize reserved3 = _reserved3;
35 return _reserved4 != nil;
37 @synthesize reserved4 = _reserved4;
40 return _reserved5 != nil;
42 @synthesize reserved5 = _reserved5;
45 return _reserved6 != nil;
47 @synthesize reserved6 = _reserved6;
48 - (BOOL)hasEscrowedSigningSPKI
50 return _escrowedSigningSPKI != nil;
52 @synthesize escrowedSigningSPKI = _escrowedSigningSPKI;
53 - (BOOL)hasEscrowedEncryptionSPKI
55 return _escrowedEncryptionSPKI != nil;
57 @synthesize escrowedEncryptionSPKI = _escrowedEncryptionSPKI;
58 - (BOOL)hasPeerSigningSPKI
60 return _peerSigningSPKI != nil;
62 @synthesize peerSigningSPKI = _peerSigningSPKI;
63 - (BOOL)hasPeerEncryptionSPKI
65 return _peerEncryptionSPKI != nil;
67 @synthesize peerEncryptionSPKI = _peerEncryptionSPKI;
70 return _reserved7 != nil;
72 @synthesize reserved7 = _reserved7;
75 return _contents != nil;
77 @synthesize contents = _contents;
79 - (NSString *)description
81 return [NSString stringWithFormat:@"%@ %@", [super description], [self dictionaryRepresentation]];
84 - (NSDictionary *)dictionaryRepresentation
86 NSMutableDictionary *dict = [NSMutableDictionary dictionary];
89 [dict setObject:self->_peerID forKey:@"peerID"];
93 [dict setObject:self->_spID forKey:@"spID"];
97 [dict setObject:self->_reserved3 forKey:@"reserved3"];
101 [dict setObject:self->_reserved4 forKey:@"reserved4"];
103 if (self->_reserved5)
105 [dict setObject:self->_reserved5 forKey:@"reserved5"];
107 if (self->_reserved6)
109 [dict setObject:self->_reserved6 forKey:@"reserved6"];
111 if (self->_escrowedSigningSPKI)
113 [dict setObject:self->_escrowedSigningSPKI forKey:@"escrowedSigningSPKI"];
115 if (self->_escrowedEncryptionSPKI)
117 [dict setObject:self->_escrowedEncryptionSPKI forKey:@"escrowedEncryptionSPKI"];
119 if (self->_peerSigningSPKI)
121 [dict setObject:self->_peerSigningSPKI forKey:@"peerSigningSPKI"];
123 if (self->_peerEncryptionSPKI)
125 [dict setObject:self->_peerEncryptionSPKI forKey:@"peerEncryptionSPKI"];
127 if (self->_reserved7)
129 [dict setObject:self->_reserved7 forKey:@"reserved7"];
133 [dict setObject:[_contents dictionaryRepresentation] forKey:@"contents"];
138 BOOL OTBottleReadFrom(__unsafe_unretained OTBottle *self, __unsafe_unretained PBDataReader *reader) {
139 while (PBReaderHasMoreData(reader)) {
143 PBReaderReadTag32AndType(reader, &tag, &aType);
145 if (PBReaderHasError(reader))
148 if (aType == TYPE_END_GROUP) {
156 NSString *new_peerID = PBReaderReadString(reader);
157 self->_peerID = new_peerID;
162 NSString *new_spID = PBReaderReadString(reader);
163 self->_spID = new_spID;
166 case 3 /* reserved3 */:
168 NSData *new_reserved3 = PBReaderReadData(reader);
169 self->_reserved3 = new_reserved3;
172 case 4 /* reserved4 */:
174 NSData *new_reserved4 = PBReaderReadData(reader);
175 self->_reserved4 = new_reserved4;
178 case 5 /* reserved5 */:
180 NSData *new_reserved5 = PBReaderReadData(reader);
181 self->_reserved5 = new_reserved5;
184 case 6 /* reserved6 */:
186 NSData *new_reserved6 = PBReaderReadData(reader);
187 self->_reserved6 = new_reserved6;
190 case 7 /* reserved7 */:
192 NSData *new_reserved7 = PBReaderReadData(reader);
193 self->_reserved7 = new_reserved7;
196 case 8 /* escrowedSigningSPKI */:
198 NSData *new_escrowedSigningSPKI = PBReaderReadData(reader);
199 self->_escrowedSigningSPKI = new_escrowedSigningSPKI;
202 case 9 /* escrowedEncryptionSPKI */:
204 NSData *new_escrowedEncryptionSPKI = PBReaderReadData(reader);
205 self->_escrowedEncryptionSPKI = new_escrowedEncryptionSPKI;
208 case 10 /* peerSigningSPKI */:
210 NSData *new_peerSigningSPKI = PBReaderReadData(reader);
211 self->_peerSigningSPKI = new_peerSigningSPKI;
214 case 11 /* peerEncryptionSPKI */:
216 NSData *new_peerEncryptionSPKI = PBReaderReadData(reader);
217 self->_peerEncryptionSPKI = new_peerEncryptionSPKI;
220 case 12 /* contents */:
222 OTAuthenticatedCiphertext *new_contents = [[OTAuthenticatedCiphertext alloc] init];
223 self->_contents = new_contents;
224 PBDataReaderMark mark_contents;
225 BOOL markError = !PBReaderPlaceMark(reader, &mark_contents);
230 BOOL inError = !OTAuthenticatedCiphertextReadFrom(new_contents, reader);
235 PBReaderRecallMark(reader, &mark_contents);
239 if (!PBReaderSkipValueWithTag(reader, tag, aType))
244 return !PBReaderHasError(reader);
247 - (BOOL)readFrom:(PBDataReader *)reader
249 return OTBottleReadFrom(self, reader);
251 - (void)writeTo:(PBDataWriter *)writer
257 PBDataWriterWriteStringField(writer, self->_peerID, 1);
264 PBDataWriterWriteStringField(writer, self->_spID, 2);
269 if (self->_reserved3)
271 PBDataWriterWriteDataField(writer, self->_reserved3, 3);
276 if (self->_reserved4)
278 PBDataWriterWriteDataField(writer, self->_reserved4, 4);
283 if (self->_reserved5)
285 PBDataWriterWriteDataField(writer, self->_reserved5, 5);
290 if (self->_reserved6)
292 PBDataWriterWriteDataField(writer, self->_reserved6, 6);
297 if (self->_reserved7)
299 PBDataWriterWriteDataField(writer, self->_reserved7, 7);
302 /* escrowedSigningSPKI */
304 if (self->_escrowedSigningSPKI)
306 PBDataWriterWriteDataField(writer, self->_escrowedSigningSPKI, 8);
309 /* escrowedEncryptionSPKI */
311 if (self->_escrowedEncryptionSPKI)
313 PBDataWriterWriteDataField(writer, self->_escrowedEncryptionSPKI, 9);
316 /* peerSigningSPKI */
318 if (self->_peerSigningSPKI)
320 PBDataWriterWriteDataField(writer, self->_peerSigningSPKI, 10);
323 /* peerEncryptionSPKI */
325 if (self->_peerEncryptionSPKI)
327 PBDataWriterWriteDataField(writer, self->_peerEncryptionSPKI, 11);
332 if (self->_contents != nil)
334 PBDataWriterWriteSubmessage(writer, self->_contents, 12);
339 - (void)copyTo:(OTBottle *)other
343 other.peerID = _peerID;
351 other.reserved3 = _reserved3;
355 other.reserved4 = _reserved4;
359 other.reserved5 = _reserved5;
363 other.reserved6 = _reserved6;
367 other.reserved7 = _reserved7;
369 if (_escrowedSigningSPKI)
371 other.escrowedSigningSPKI = _escrowedSigningSPKI;
373 if (_escrowedEncryptionSPKI)
375 other.escrowedEncryptionSPKI = _escrowedEncryptionSPKI;
377 if (_peerSigningSPKI)
379 other.peerSigningSPKI = _peerSigningSPKI;
381 if (_peerEncryptionSPKI)
383 other.peerEncryptionSPKI = _peerEncryptionSPKI;
387 other.contents = _contents;
391 - (id)copyWithZone:(NSZone *)zone
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];
409 - (BOOL)isEqual:(id)object
411 OTBottle *other = (OTBottle *)object;
412 return [other isMemberOfClass:[self class]]
414 ((!self->_peerID && !other->_peerID) || [self->_peerID isEqual:other->_peerID])
416 ((!self->_spID && !other->_spID) || [self->_spID isEqual:other->_spID])
418 ((!self->_reserved3 && !other->_reserved3) || [self->_reserved3 isEqual:other->_reserved3])
420 ((!self->_reserved4 && !other->_reserved4) || [self->_reserved4 isEqual:other->_reserved4])
422 ((!self->_reserved5 && !other->_reserved5) || [self->_reserved5 isEqual:other->_reserved5])
424 ((!self->_reserved6 && !other->_reserved6) || [self->_reserved6 isEqual:other->_reserved6])
426 ((!self->_reserved7 && !other->_reserved7) || [self->_reserved7 isEqual:other->_reserved7])
428 ((!self->_escrowedSigningSPKI && !other->_escrowedSigningSPKI) || [self->_escrowedSigningSPKI isEqual:other->_escrowedSigningSPKI])
430 ((!self->_escrowedEncryptionSPKI && !other->_escrowedEncryptionSPKI) || [self->_escrowedEncryptionSPKI isEqual:other->_escrowedEncryptionSPKI])
432 ((!self->_peerSigningSPKI && !other->_peerSigningSPKI) || [self->_peerSigningSPKI isEqual:other->_peerSigningSPKI])
434 ((!self->_peerEncryptionSPKI && !other->_peerEncryptionSPKI) || [self->_peerEncryptionSPKI isEqual:other->_peerEncryptionSPKI])
436 ((!self->_contents && !other->_contents) || [self->_contents isEqual:other->_contents])
448 [self->_reserved3 hash]
450 [self->_reserved4 hash]
452 [self->_reserved5 hash]
454 [self->_reserved6 hash]
456 [self->_reserved7 hash]
458 [self->_escrowedSigningSPKI hash]
460 [self->_escrowedEncryptionSPKI hash]
462 [self->_peerSigningSPKI hash]
464 [self->_peerEncryptionSPKI hash]
466 [self->_contents hash]
470 - (void)mergeFrom:(OTBottle *)other
474 [self setPeerID:other->_peerID];
478 [self setSpID:other->_spID];
480 if (other->_reserved3)
482 [self setReserved3:other->_reserved3];
484 if (other->_reserved4)
486 [self setReserved4:other->_reserved4];
488 if (other->_reserved5)
490 [self setReserved5:other->_reserved5];
492 if (other->_reserved6)
494 [self setReserved6:other->_reserved6];
496 if (other->_reserved7)
498 [self setReserved7:other->_reserved7];
500 if (other->_escrowedSigningSPKI)
502 [self setEscrowedSigningSPKI:other->_escrowedSigningSPKI];
504 if (other->_escrowedEncryptionSPKI)
506 [self setEscrowedEncryptionSPKI:other->_escrowedEncryptionSPKI];
508 if (other->_peerSigningSPKI)
510 [self setPeerSigningSPKI:other->_peerSigningSPKI];
512 if (other->_peerEncryptionSPKI)
514 [self setPeerEncryptionSPKI:other->_peerEncryptionSPKI];
516 if (self->_contents && other->_contents)
518 [self->_contents mergeFrom:other->_contents];
520 else if (!self->_contents && other->_contents)
522 [self setContents:other->_contents];