]> git.saurik.com Git - apple/security.git/blob - keychain/ot/proto/source/OTSOSMessage.m
Security-59306.11.20.tar.gz
[apple/security.git] / keychain / ot / proto / source / OTSOSMessage.m
1 // This file was automatically generated by protocompiler
2 // DO NOT EDIT!
3 // Compiled from OTPairingMessage.proto
4
5 #import "OTSOSMessage.h"
6 #import <ProtocolBuffer/PBConstants.h>
7 #import <ProtocolBuffer/PBHashUtil.h>
8 #import <ProtocolBuffer/PBDataReader.h>
9
10 #if !__has_feature(objc_arc)
11 # 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.
12 #endif
13
14 @implementation OTSOSMessage
15
16 - (BOOL)hasCredential
17 {
18 return _credential != nil;
19 }
20 @synthesize credential = _credential;
21 - (BOOL)hasPeerInfo
22 {
23 return _peerInfo != nil;
24 }
25 @synthesize peerInfo = _peerInfo;
26 - (BOOL)hasCircleBlob
27 {
28 return _circleBlob != nil;
29 }
30 @synthesize circleBlob = _circleBlob;
31 - (BOOL)hasInitialSyncItems
32 {
33 return _initialSyncItems != nil;
34 }
35 @synthesize initialSyncItems = _initialSyncItems;
36
37 - (NSString *)description
38 {
39 return [NSString stringWithFormat:@"%@ %@", [super description], [self dictionaryRepresentation]];
40 }
41
42 - (NSDictionary *)dictionaryRepresentation
43 {
44 NSMutableDictionary *dict = [NSMutableDictionary dictionary];
45 if (self->_credential)
46 {
47 [dict setObject:self->_credential forKey:@"credential"];
48 }
49 if (self->_peerInfo)
50 {
51 [dict setObject:self->_peerInfo forKey:@"peerInfo"];
52 }
53 if (self->_circleBlob)
54 {
55 [dict setObject:self->_circleBlob forKey:@"circleBlob"];
56 }
57 if (self->_initialSyncItems)
58 {
59 [dict setObject:self->_initialSyncItems forKey:@"initialSyncItems"];
60 }
61 return dict;
62 }
63
64 BOOL OTSOSMessageReadFrom(__unsafe_unretained OTSOSMessage *self, __unsafe_unretained PBDataReader *reader) {
65 while (PBReaderHasMoreData(reader)) {
66 uint32_t tag = 0;
67 uint8_t aType = 0;
68
69 PBReaderReadTag32AndType(reader, &tag, &aType);
70
71 if (PBReaderHasError(reader))
72 break;
73
74 if (aType == TYPE_END_GROUP) {
75 break;
76 }
77
78 switch (tag) {
79
80 case 1 /* credential */:
81 {
82 NSData *new_credential = PBReaderReadData(reader);
83 self->_credential = new_credential;
84 }
85 break;
86 case 2 /* peerInfo */:
87 {
88 NSData *new_peerInfo = PBReaderReadData(reader);
89 self->_peerInfo = new_peerInfo;
90 }
91 break;
92 case 3 /* circleBlob */:
93 {
94 NSData *new_circleBlob = PBReaderReadData(reader);
95 self->_circleBlob = new_circleBlob;
96 }
97 break;
98 case 4 /* initialSyncItems */:
99 {
100 NSData *new_initialSyncItems = PBReaderReadData(reader);
101 self->_initialSyncItems = new_initialSyncItems;
102 }
103 break;
104 default:
105 if (!PBReaderSkipValueWithTag(reader, tag, aType))
106 return NO;
107 break;
108 }
109 }
110 return !PBReaderHasError(reader);
111 }
112
113 - (BOOL)readFrom:(PBDataReader *)reader
114 {
115 return OTSOSMessageReadFrom(self, reader);
116 }
117 - (void)writeTo:(PBDataWriter *)writer
118 {
119 /* credential */
120 {
121 if (self->_credential)
122 {
123 PBDataWriterWriteDataField(writer, self->_credential, 1);
124 }
125 }
126 /* peerInfo */
127 {
128 if (self->_peerInfo)
129 {
130 PBDataWriterWriteDataField(writer, self->_peerInfo, 2);
131 }
132 }
133 /* circleBlob */
134 {
135 if (self->_circleBlob)
136 {
137 PBDataWriterWriteDataField(writer, self->_circleBlob, 3);
138 }
139 }
140 /* initialSyncItems */
141 {
142 if (self->_initialSyncItems)
143 {
144 PBDataWriterWriteDataField(writer, self->_initialSyncItems, 4);
145 }
146 }
147 }
148
149 - (void)copyTo:(OTSOSMessage *)other
150 {
151 if (_credential)
152 {
153 other.credential = _credential;
154 }
155 if (_peerInfo)
156 {
157 other.peerInfo = _peerInfo;
158 }
159 if (_circleBlob)
160 {
161 other.circleBlob = _circleBlob;
162 }
163 if (_initialSyncItems)
164 {
165 other.initialSyncItems = _initialSyncItems;
166 }
167 }
168
169 - (id)copyWithZone:(NSZone *)zone
170 {
171 OTSOSMessage *copy = [[[self class] allocWithZone:zone] init];
172 copy->_credential = [_credential copyWithZone:zone];
173 copy->_peerInfo = [_peerInfo copyWithZone:zone];
174 copy->_circleBlob = [_circleBlob copyWithZone:zone];
175 copy->_initialSyncItems = [_initialSyncItems copyWithZone:zone];
176 return copy;
177 }
178
179 - (BOOL)isEqual:(id)object
180 {
181 OTSOSMessage *other = (OTSOSMessage *)object;
182 return [other isMemberOfClass:[self class]]
183 &&
184 ((!self->_credential && !other->_credential) || [self->_credential isEqual:other->_credential])
185 &&
186 ((!self->_peerInfo && !other->_peerInfo) || [self->_peerInfo isEqual:other->_peerInfo])
187 &&
188 ((!self->_circleBlob && !other->_circleBlob) || [self->_circleBlob isEqual:other->_circleBlob])
189 &&
190 ((!self->_initialSyncItems && !other->_initialSyncItems) || [self->_initialSyncItems isEqual:other->_initialSyncItems])
191 ;
192 }
193
194 - (NSUInteger)hash
195 {
196 return 0
197 ^
198 [self->_credential hash]
199 ^
200 [self->_peerInfo hash]
201 ^
202 [self->_circleBlob hash]
203 ^
204 [self->_initialSyncItems hash]
205 ;
206 }
207
208 - (void)mergeFrom:(OTSOSMessage *)other
209 {
210 if (other->_credential)
211 {
212 [self setCredential:other->_credential];
213 }
214 if (other->_peerInfo)
215 {
216 [self setPeerInfo:other->_peerInfo];
217 }
218 if (other->_circleBlob)
219 {
220 [self setCircleBlob:other->_circleBlob];
221 }
222 if (other->_initialSyncItems)
223 {
224 [self setInitialSyncItems:other->_initialSyncItems];
225 }
226 }
227
228 @end
229