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