]> git.saurik.com Git - apple/security.git/blob - keychain/ot/proto/generated_source/OTPairingMessage.m
Security-59754.41.1.tar.gz
[apple/security.git] / keychain / ot / proto / generated_source / OTPairingMessage.m
1 // This file was automatically generated by protocompiler
2 // DO NOT EDIT!
3 // Compiled from OTPairingMessage.proto
4
5 #import "OTPairingMessage.h"
6 #import <ProtocolBuffer/PBConstants.h>
7 #import <ProtocolBuffer/PBHashUtil.h>
8 #import <ProtocolBuffer/PBDataReader.h>
9
10 #import "OTApplicantToSponsorRound2M1.h"
11 #import "OTSponsorToApplicantRound1M2.h"
12 #import "OTSponsorToApplicantRound2M2.h"
13 #import "OTSupportOctagonMessage.h"
14 #import "OTSupportSOSMessage.h"
15
16 #if !__has_feature(objc_arc)
17 # 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.
18 #endif
19
20 @implementation OTPairingMessage
21
22 - (BOOL)hasEpoch
23 {
24 return _epoch != nil;
25 }
26 @synthesize epoch = _epoch;
27 - (BOOL)hasPrepare
28 {
29 return _prepare != nil;
30 }
31 @synthesize prepare = _prepare;
32 - (BOOL)hasVoucher
33 {
34 return _voucher != nil;
35 }
36 @synthesize voucher = _voucher;
37 - (BOOL)hasSupportsOctagon
38 {
39 return _supportsOctagon != nil;
40 }
41 @synthesize supportsOctagon = _supportsOctagon;
42 - (BOOL)hasSupportsSOS
43 {
44 return _supportsSOS != nil;
45 }
46 @synthesize supportsSOS = _supportsSOS;
47
48 - (NSString *)description
49 {
50 return [NSString stringWithFormat:@"%@ %@", [super description], [self dictionaryRepresentation]];
51 }
52
53 - (NSDictionary *)dictionaryRepresentation
54 {
55 NSMutableDictionary *dict = [NSMutableDictionary dictionary];
56 if (self->_epoch)
57 {
58 [dict setObject:[_epoch dictionaryRepresentation] forKey:@"epoch"];
59 }
60 if (self->_prepare)
61 {
62 [dict setObject:[_prepare dictionaryRepresentation] forKey:@"prepare"];
63 }
64 if (self->_voucher)
65 {
66 [dict setObject:[_voucher dictionaryRepresentation] forKey:@"voucher"];
67 }
68 if (self->_supportsOctagon)
69 {
70 [dict setObject:[_supportsOctagon dictionaryRepresentation] forKey:@"supportsOctagon"];
71 }
72 if (self->_supportsSOS)
73 {
74 [dict setObject:[_supportsSOS dictionaryRepresentation] forKey:@"supportsSOS"];
75 }
76 return dict;
77 }
78
79 BOOL OTPairingMessageReadFrom(__unsafe_unretained OTPairingMessage *self, __unsafe_unretained PBDataReader *reader) {
80 while (PBReaderHasMoreData(reader)) {
81 uint32_t tag = 0;
82 uint8_t aType = 0;
83
84 PBReaderReadTag32AndType(reader, &tag, &aType);
85
86 if (PBReaderHasError(reader))
87 break;
88
89 if (aType == TYPE_END_GROUP) {
90 break;
91 }
92
93 switch (tag) {
94
95 case 1 /* epoch */:
96 {
97 OTSponsorToApplicantRound1M2 *new_epoch = [[OTSponsorToApplicantRound1M2 alloc] init];
98 self->_epoch = new_epoch;
99 PBDataReaderMark mark_epoch;
100 BOOL markError = !PBReaderPlaceMark(reader, &mark_epoch);
101 if (markError)
102 {
103 return NO;
104 }
105 BOOL inError = !OTSponsorToApplicantRound1M2ReadFrom(new_epoch, reader);
106 if (inError)
107 {
108 return NO;
109 }
110 PBReaderRecallMark(reader, &mark_epoch);
111 }
112 break;
113 case 2 /* prepare */:
114 {
115 OTApplicantToSponsorRound2M1 *new_prepare = [[OTApplicantToSponsorRound2M1 alloc] init];
116 self->_prepare = new_prepare;
117 PBDataReaderMark mark_prepare;
118 BOOL markError = !PBReaderPlaceMark(reader, &mark_prepare);
119 if (markError)
120 {
121 return NO;
122 }
123 BOOL inError = !OTApplicantToSponsorRound2M1ReadFrom(new_prepare, reader);
124 if (inError)
125 {
126 return NO;
127 }
128 PBReaderRecallMark(reader, &mark_prepare);
129 }
130 break;
131 case 3 /* voucher */:
132 {
133 OTSponsorToApplicantRound2M2 *new_voucher = [[OTSponsorToApplicantRound2M2 alloc] init];
134 self->_voucher = new_voucher;
135 PBDataReaderMark mark_voucher;
136 BOOL markError = !PBReaderPlaceMark(reader, &mark_voucher);
137 if (markError)
138 {
139 return NO;
140 }
141 BOOL inError = !OTSponsorToApplicantRound2M2ReadFrom(new_voucher, reader);
142 if (inError)
143 {
144 return NO;
145 }
146 PBReaderRecallMark(reader, &mark_voucher);
147 }
148 break;
149 case 5 /* supportsOctagon */:
150 {
151 OTSupportOctagonMessage *new_supportsOctagon = [[OTSupportOctagonMessage alloc] init];
152 self->_supportsOctagon = new_supportsOctagon;
153 PBDataReaderMark mark_supportsOctagon;
154 BOOL markError = !PBReaderPlaceMark(reader, &mark_supportsOctagon);
155 if (markError)
156 {
157 return NO;
158 }
159 BOOL inError = !OTSupportOctagonMessageReadFrom(new_supportsOctagon, reader);
160 if (inError)
161 {
162 return NO;
163 }
164 PBReaderRecallMark(reader, &mark_supportsOctagon);
165 }
166 break;
167 case 6 /* supportsSOS */:
168 {
169 OTSupportSOSMessage *new_supportsSOS = [[OTSupportSOSMessage alloc] init];
170 self->_supportsSOS = new_supportsSOS;
171 PBDataReaderMark mark_supportsSOS;
172 BOOL markError = !PBReaderPlaceMark(reader, &mark_supportsSOS);
173 if (markError)
174 {
175 return NO;
176 }
177 BOOL inError = !OTSupportSOSMessageReadFrom(new_supportsSOS, reader);
178 if (inError)
179 {
180 return NO;
181 }
182 PBReaderRecallMark(reader, &mark_supportsSOS);
183 }
184 break;
185 default:
186 if (!PBReaderSkipValueWithTag(reader, tag, aType))
187 return NO;
188 break;
189 }
190 }
191 return !PBReaderHasError(reader);
192 }
193
194 - (BOOL)readFrom:(PBDataReader *)reader
195 {
196 return OTPairingMessageReadFrom(self, reader);
197 }
198 - (void)writeTo:(PBDataWriter *)writer
199 {
200 /* epoch */
201 {
202 if (self->_epoch != nil)
203 {
204 PBDataWriterWriteSubmessage(writer, self->_epoch, 1);
205 }
206 }
207 /* prepare */
208 {
209 if (self->_prepare != nil)
210 {
211 PBDataWriterWriteSubmessage(writer, self->_prepare, 2);
212 }
213 }
214 /* voucher */
215 {
216 if (self->_voucher != nil)
217 {
218 PBDataWriterWriteSubmessage(writer, self->_voucher, 3);
219 }
220 }
221 /* supportsOctagon */
222 {
223 if (self->_supportsOctagon != nil)
224 {
225 PBDataWriterWriteSubmessage(writer, self->_supportsOctagon, 5);
226 }
227 }
228 /* supportsSOS */
229 {
230 if (self->_supportsSOS != nil)
231 {
232 PBDataWriterWriteSubmessage(writer, self->_supportsSOS, 6);
233 }
234 }
235 }
236
237 - (void)copyTo:(OTPairingMessage *)other
238 {
239 if (_epoch)
240 {
241 other.epoch = _epoch;
242 }
243 if (_prepare)
244 {
245 other.prepare = _prepare;
246 }
247 if (_voucher)
248 {
249 other.voucher = _voucher;
250 }
251 if (_supportsOctagon)
252 {
253 other.supportsOctagon = _supportsOctagon;
254 }
255 if (_supportsSOS)
256 {
257 other.supportsSOS = _supportsSOS;
258 }
259 }
260
261 - (id)copyWithZone:(NSZone *)zone
262 {
263 OTPairingMessage *copy = [[[self class] allocWithZone:zone] init];
264 copy->_epoch = [_epoch copyWithZone:zone];
265 copy->_prepare = [_prepare copyWithZone:zone];
266 copy->_voucher = [_voucher copyWithZone:zone];
267 copy->_supportsOctagon = [_supportsOctagon copyWithZone:zone];
268 copy->_supportsSOS = [_supportsSOS copyWithZone:zone];
269 return copy;
270 }
271
272 - (BOOL)isEqual:(id)object
273 {
274 OTPairingMessage *other = (OTPairingMessage *)object;
275 return [other isMemberOfClass:[self class]]
276 &&
277 ((!self->_epoch && !other->_epoch) || [self->_epoch isEqual:other->_epoch])
278 &&
279 ((!self->_prepare && !other->_prepare) || [self->_prepare isEqual:other->_prepare])
280 &&
281 ((!self->_voucher && !other->_voucher) || [self->_voucher isEqual:other->_voucher])
282 &&
283 ((!self->_supportsOctagon && !other->_supportsOctagon) || [self->_supportsOctagon isEqual:other->_supportsOctagon])
284 &&
285 ((!self->_supportsSOS && !other->_supportsSOS) || [self->_supportsSOS isEqual:other->_supportsSOS])
286 ;
287 }
288
289 - (NSUInteger)hash
290 {
291 return 0
292 ^
293 [self->_epoch hash]
294 ^
295 [self->_prepare hash]
296 ^
297 [self->_voucher hash]
298 ^
299 [self->_supportsOctagon hash]
300 ^
301 [self->_supportsSOS hash]
302 ;
303 }
304
305 - (void)mergeFrom:(OTPairingMessage *)other
306 {
307 if (self->_epoch && other->_epoch)
308 {
309 [self->_epoch mergeFrom:other->_epoch];
310 }
311 else if (!self->_epoch && other->_epoch)
312 {
313 [self setEpoch:other->_epoch];
314 }
315 if (self->_prepare && other->_prepare)
316 {
317 [self->_prepare mergeFrom:other->_prepare];
318 }
319 else if (!self->_prepare && other->_prepare)
320 {
321 [self setPrepare:other->_prepare];
322 }
323 if (self->_voucher && other->_voucher)
324 {
325 [self->_voucher mergeFrom:other->_voucher];
326 }
327 else if (!self->_voucher && other->_voucher)
328 {
329 [self setVoucher:other->_voucher];
330 }
331 if (self->_supportsOctagon && other->_supportsOctagon)
332 {
333 [self->_supportsOctagon mergeFrom:other->_supportsOctagon];
334 }
335 else if (!self->_supportsOctagon && other->_supportsOctagon)
336 {
337 [self setSupportsOctagon:other->_supportsOctagon];
338 }
339 if (self->_supportsSOS && other->_supportsSOS)
340 {
341 [self->_supportsSOS mergeFrom:other->_supportsSOS];
342 }
343 else if (!self->_supportsSOS && other->_supportsSOS)
344 {
345 [self setSupportsSOS:other->_supportsSOS];
346 }
347 }
348
349 @end
350