/work/obj-fuzz/ipc/ipdl/PUDPSocket.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | // |
2 | | // Automatically generated by ipdlc. |
3 | | // Edit at your own risk |
4 | | // |
5 | | |
6 | | |
7 | | #include "mozilla/net/NeckoMessageUtils.h" |
8 | | #include "mozilla/net/DNS.h" |
9 | | #include "prio.h" |
10 | | #include "mozilla/net/PNeckoParent.h" |
11 | | #include "mozilla/net/PNeckoChild.h" |
12 | | #include "mozilla/ipc/PBackgroundParent.h" |
13 | | #include "mozilla/ipc/PBackgroundChild.h" |
14 | | #include "mozilla/ipc/PFileDescriptorSetParent.h" |
15 | | #include "mozilla/ipc/PFileDescriptorSetChild.h" |
16 | | #include "mozilla/ipc/PChildToParentStreamParent.h" |
17 | | #include "mozilla/ipc/PChildToParentStreamChild.h" |
18 | | #include "mozilla/ipc/PParentToChildStreamParent.h" |
19 | | #include "mozilla/ipc/PParentToChildStreamChild.h" |
20 | | #include "mozilla/net/PUDPSocket.h" |
21 | | |
22 | | namespace mozilla { |
23 | | namespace net { |
24 | | namespace PUDPSocket { |
25 | | |
26 | | nsresult |
27 | | CreateEndpoints( |
28 | | base::ProcessId aParentDestPid, |
29 | | base::ProcessId aChildDestPid, |
30 | | mozilla::ipc::Endpoint<mozilla::net::PUDPSocketParent>* aParent, |
31 | | mozilla::ipc::Endpoint<mozilla::net::PUDPSocketChild>* aChild) |
32 | 0 | { |
33 | 0 | return mozilla::ipc::CreateEndpoints(mozilla::ipc::PrivateIPDLInterface(), aParentDestPid, aChildDestPid, aParent, aChild); |
34 | 0 | } |
35 | | IPC::Message* |
36 | | Msg_Bind(int32_t routingId) |
37 | 0 | { |
38 | 0 | return IPC::Message::IPDLMessage(routingId, Msg_Bind__ID, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::NOT_INTERRUPT, IPC::Message::NOT_REPLY)); |
39 | 0 | } |
40 | | IPC::Message* |
41 | | Msg_Connect(int32_t routingId) |
42 | 0 | { |
43 | 0 | return IPC::Message::IPDLMessage(routingId, Msg_Connect__ID, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::NOT_INTERRUPT, IPC::Message::NOT_REPLY)); |
44 | 0 | } |
45 | | IPC::Message* |
46 | | Msg_OutgoingData(int32_t routingId) |
47 | 0 | { |
48 | 0 | return IPC::Message::IPDLMessage(routingId, Msg_OutgoingData__ID, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::NOT_INTERRUPT, IPC::Message::NOT_REPLY)); |
49 | 0 | } |
50 | | IPC::Message* |
51 | | Msg_JoinMulticast(int32_t routingId) |
52 | 0 | { |
53 | 0 | return IPC::Message::IPDLMessage(routingId, Msg_JoinMulticast__ID, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::NOT_INTERRUPT, IPC::Message::NOT_REPLY)); |
54 | 0 | } |
55 | | IPC::Message* |
56 | | Msg_LeaveMulticast(int32_t routingId) |
57 | 0 | { |
58 | 0 | return IPC::Message::IPDLMessage(routingId, Msg_LeaveMulticast__ID, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::NOT_INTERRUPT, IPC::Message::NOT_REPLY)); |
59 | 0 | } |
60 | | IPC::Message* |
61 | | Msg_Close(int32_t routingId) |
62 | 0 | { |
63 | 0 | return IPC::Message::IPDLMessage(routingId, Msg_Close__ID, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::NOT_INTERRUPT, IPC::Message::NOT_REPLY)); |
64 | 0 | } |
65 | | IPC::Message* |
66 | | Msg_RequestDelete(int32_t routingId) |
67 | 0 | { |
68 | 0 | return IPC::Message::IPDLMessage(routingId, Msg_RequestDelete__ID, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::NOT_INTERRUPT, IPC::Message::NOT_REPLY)); |
69 | 0 | } |
70 | | IPC::Message* |
71 | | Msg_CallbackOpened(int32_t routingId) |
72 | 0 | { |
73 | 0 | return IPC::Message::IPDLMessage(routingId, Msg_CallbackOpened__ID, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::NOT_INTERRUPT, IPC::Message::NOT_REPLY)); |
74 | 0 | } |
75 | | IPC::Message* |
76 | | Msg_CallbackConnected(int32_t routingId) |
77 | 0 | { |
78 | 0 | return IPC::Message::IPDLMessage(routingId, Msg_CallbackConnected__ID, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::NOT_INTERRUPT, IPC::Message::NOT_REPLY)); |
79 | 0 | } |
80 | | IPC::Message* |
81 | | Msg_CallbackClosed(int32_t routingId) |
82 | 0 | { |
83 | 0 | return IPC::Message::IPDLMessage(routingId, Msg_CallbackClosed__ID, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::NOT_INTERRUPT, IPC::Message::NOT_REPLY)); |
84 | 0 | } |
85 | | IPC::Message* |
86 | | Msg_CallbackReceivedData(int32_t routingId) |
87 | 0 | { |
88 | 0 | return IPC::Message::IPDLMessage(routingId, Msg_CallbackReceivedData__ID, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::NOT_INTERRUPT, IPC::Message::NOT_REPLY)); |
89 | 0 | } |
90 | | IPC::Message* |
91 | | Msg_CallbackError(int32_t routingId) |
92 | 0 | { |
93 | 0 | return IPC::Message::IPDLMessage(routingId, Msg_CallbackError__ID, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::NOT_INTERRUPT, IPC::Message::NOT_REPLY)); |
94 | 0 | } |
95 | | IPC::Message* |
96 | | Msg___delete__(int32_t routingId) |
97 | 0 | { |
98 | 0 | return IPC::Message::IPDLMessage(routingId, Msg___delete____ID, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::NOT_INTERRUPT, IPC::Message::NOT_REPLY)); |
99 | 0 | } |
100 | | IPC::Message* |
101 | | Reply___delete__(int32_t routingId) |
102 | 0 | { |
103 | 0 | return IPC::Message::IPDLMessage(routingId, Reply___delete____ID, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::NOT_INTERRUPT, IPC::Message::REPLY)); |
104 | 0 | } |
105 | | |
106 | | } // namespace PUDPSocket |
107 | | } // namespace net |
108 | | } // namespace mozilla |
109 | | |
110 | | //----------------------------------------------------------------------------- |
111 | | // Method definitions for the IPDL type |struct UDPAddressInfo| |
112 | | // |
113 | | auto UDPAddressInfo::operator==(const UDPAddressInfo& _o) const -> bool |
114 | 0 | { |
115 | 0 | if ((!((addr()) == ((_o).addr())))) { |
116 | 0 | return false; |
117 | 0 | } |
118 | 0 | if ((!((port()) == ((_o).port())))) { |
119 | 0 | return false; |
120 | 0 | } |
121 | 0 | return true; |
122 | 0 | } |
123 | | |
124 | | auto UDPAddressInfo::operator!=(const UDPAddressInfo& _o) const -> bool |
125 | 0 | { |
126 | 0 | return (!(operator==(_o))); |
127 | 0 | } |
128 | | |
129 | | |
130 | | namespace mozilla { |
131 | | namespace ipc { |
132 | | auto IPDLParamTraits<UDPAddressInfo>::Write( |
133 | | IPC::Message* aMsg, |
134 | | mozilla::ipc::IProtocol* aActor, |
135 | | const paramType& aVar) -> void |
136 | 0 | { |
137 | 0 | WriteIPDLParam(aMsg, aActor, (aVar).addr()); |
138 | 0 | // Sentinel = 'addr' |
139 | 0 | (aMsg)->WriteSentinel(1506625701); |
140 | 0 | WriteIPDLParam(aMsg, aActor, (aVar).port()); |
141 | 0 | // Sentinel = 'port' |
142 | 0 | (aMsg)->WriteSentinel(3633211549); |
143 | 0 | } |
144 | | |
145 | | auto IPDLParamTraits<UDPAddressInfo>::Read( |
146 | | const IPC::Message* aMsg, |
147 | | PickleIterator* aIter, |
148 | | mozilla::ipc::IProtocol* aActor, |
149 | | paramType* aVar) -> bool |
150 | 0 | { |
151 | 0 | if ((!(ReadIPDLParam(aMsg, aIter, aActor, (&((aVar)->addr())))))) { |
152 | 0 | (aActor)->FatalError("Error deserializing 'addr' (nsCString) member of 'UDPAddressInfo'"); |
153 | 0 | return false; |
154 | 0 | } |
155 | 0 | // Sentinel = 'addr' |
156 | 0 | if ((!((aMsg)->ReadSentinel(aIter, 1506625701)))) { |
157 | 0 | mozilla::ipc::SentinelReadError("Error deserializing 'addr' (nsCString) member of 'UDPAddressInfo'"); |
158 | 0 | return false; |
159 | 0 | } |
160 | 0 | if ((!(ReadIPDLParam(aMsg, aIter, aActor, (&((aVar)->port())))))) { |
161 | 0 | (aActor)->FatalError("Error deserializing 'port' (uint16_t) member of 'UDPAddressInfo'"); |
162 | 0 | return false; |
163 | 0 | } |
164 | 0 | // Sentinel = 'port' |
165 | 0 | if ((!((aMsg)->ReadSentinel(aIter, 3633211549)))) { |
166 | 0 | mozilla::ipc::SentinelReadError("Error deserializing 'port' (uint16_t) member of 'UDPAddressInfo'"); |
167 | 0 | return false; |
168 | 0 | } |
169 | 0 | return true; |
170 | 0 | } |
171 | | |
172 | | } // namespace ipc |
173 | | } // namespace mozilla |
174 | | |
175 | | //----------------------------------------------------------------------------- |
176 | | // Method definitions for the IPDL type |union UDPSocketAddr| |
177 | | // |
178 | | auto UDPSocketAddr::MaybeDestroy(Type aNewType) -> bool |
179 | 0 | { |
180 | 0 | if ((mType) == (T__None)) { |
181 | 0 | return true; |
182 | 0 | } |
183 | 0 | if ((mType) == (aNewType)) { |
184 | 0 | return false; |
185 | 0 | } |
186 | 0 | switch (mType) { |
187 | 0 | case TUDPAddressInfo: |
188 | 0 | { |
189 | 0 | (ptr_UDPAddressInfo())->~UDPAddressInfo__tdef(); |
190 | 0 | break; |
191 | 0 | } |
192 | 0 | case TNetAddr: |
193 | 0 | { |
194 | 0 | (ptr_NetAddr())->~NetAddr__tdef(); |
195 | 0 | break; |
196 | 0 | } |
197 | 0 | default: |
198 | 0 | { |
199 | 0 | mozilla::ipc::LogicError("not reached"); |
200 | 0 | break; |
201 | 0 | } |
202 | 0 | } |
203 | 0 | return true; |
204 | 0 | } |
205 | | |
206 | | MOZ_IMPLICIT UDPSocketAddr::UDPSocketAddr(const UDPAddressInfo& aOther) |
207 | 0 | { |
208 | 0 | new (mozilla::KnownNotNull, ptr_UDPAddressInfo()) UDPAddressInfo(aOther); |
209 | 0 | mType = TUDPAddressInfo; |
210 | 0 | } |
211 | | |
212 | | MOZ_IMPLICIT UDPSocketAddr::UDPSocketAddr(UDPAddressInfo&& aOther) |
213 | 0 | { |
214 | 0 | new (mozilla::KnownNotNull, ptr_UDPAddressInfo()) UDPAddressInfo(std::move(aOther)); |
215 | 0 | mType = TUDPAddressInfo; |
216 | 0 | } |
217 | | |
218 | | MOZ_IMPLICIT UDPSocketAddr::UDPSocketAddr(const NetAddr& aOther) |
219 | 0 | { |
220 | 0 | new (mozilla::KnownNotNull, ptr_NetAddr()) NetAddr(aOther); |
221 | 0 | mType = TNetAddr; |
222 | 0 | } |
223 | | |
224 | | MOZ_IMPLICIT UDPSocketAddr::UDPSocketAddr(NetAddr&& aOther) |
225 | 0 | { |
226 | 0 | new (mozilla::KnownNotNull, ptr_NetAddr()) NetAddr(std::move(aOther)); |
227 | 0 | mType = TNetAddr; |
228 | 0 | } |
229 | | |
230 | | MOZ_IMPLICIT UDPSocketAddr::UDPSocketAddr(const UDPSocketAddr& aOther) |
231 | 0 | { |
232 | 0 | (aOther).AssertSanity(); |
233 | 0 | switch ((aOther).type()) { |
234 | 0 | case TUDPAddressInfo: |
235 | 0 | { |
236 | 0 | new (mozilla::KnownNotNull, ptr_UDPAddressInfo()) UDPAddressInfo((aOther).get_UDPAddressInfo()); |
237 | 0 | break; |
238 | 0 | } |
239 | 0 | case TNetAddr: |
240 | 0 | { |
241 | 0 | new (mozilla::KnownNotNull, ptr_NetAddr()) NetAddr((aOther).get_NetAddr()); |
242 | 0 | break; |
243 | 0 | } |
244 | 0 | case T__None: |
245 | 0 | { |
246 | 0 | break; |
247 | 0 | } |
248 | 0 | default: |
249 | 0 | { |
250 | 0 | mozilla::ipc::LogicError("unreached"); |
251 | 0 | return; |
252 | 0 | } |
253 | 0 | } |
254 | 0 | mType = (aOther).type(); |
255 | 0 | } |
256 | | |
257 | | MOZ_IMPLICIT UDPSocketAddr::UDPSocketAddr(UDPSocketAddr&& aOther) |
258 | 0 | { |
259 | 0 | (aOther).AssertSanity(); |
260 | 0 | Type t = (aOther).type(); |
261 | 0 | switch (t) { |
262 | 0 | case TUDPAddressInfo: |
263 | 0 | { |
264 | 0 | new (mozilla::KnownNotNull, ptr_UDPAddressInfo()) UDPAddressInfo(std::move((aOther).get_UDPAddressInfo())); |
265 | 0 | static_cast<void>((aOther).MaybeDestroy(T__None)); |
266 | 0 | break; |
267 | 0 | } |
268 | 0 | case TNetAddr: |
269 | 0 | { |
270 | 0 | new (mozilla::KnownNotNull, ptr_NetAddr()) NetAddr(std::move((aOther).get_NetAddr())); |
271 | 0 | static_cast<void>((aOther).MaybeDestroy(T__None)); |
272 | 0 | break; |
273 | 0 | } |
274 | 0 | case T__None: |
275 | 0 | { |
276 | 0 | break; |
277 | 0 | } |
278 | 0 | default: |
279 | 0 | { |
280 | 0 | mozilla::ipc::LogicError("unreached"); |
281 | 0 | return; |
282 | 0 | } |
283 | 0 | } |
284 | 0 | (aOther).mType = T__None; |
285 | 0 | mType = t; |
286 | 0 | } |
287 | | |
288 | | UDPSocketAddr::~UDPSocketAddr() |
289 | 0 | { |
290 | 0 | static_cast<void>(MaybeDestroy(T__None)); |
291 | 0 | } |
292 | | |
293 | | auto UDPSocketAddr::operator=(const UDPAddressInfo& aRhs) -> UDPSocketAddr& |
294 | 0 | { |
295 | 0 | if (MaybeDestroy(TUDPAddressInfo)) { |
296 | 0 | new (mozilla::KnownNotNull, ptr_UDPAddressInfo()) UDPAddressInfo; |
297 | 0 | } |
298 | 0 | (*(ptr_UDPAddressInfo())) = aRhs; |
299 | 0 | mType = TUDPAddressInfo; |
300 | 0 | return (*(this)); |
301 | 0 | } |
302 | | |
303 | | auto UDPSocketAddr::operator=(UDPAddressInfo&& aRhs) -> UDPSocketAddr& |
304 | 0 | { |
305 | 0 | if (MaybeDestroy(TUDPAddressInfo)) { |
306 | 0 | new (mozilla::KnownNotNull, ptr_UDPAddressInfo()) UDPAddressInfo; |
307 | 0 | } |
308 | 0 | (*(ptr_UDPAddressInfo())) = std::move(aRhs); |
309 | 0 | mType = TUDPAddressInfo; |
310 | 0 | return (*(this)); |
311 | 0 | } |
312 | | |
313 | | auto UDPSocketAddr::operator=(const NetAddr& aRhs) -> UDPSocketAddr& |
314 | 0 | { |
315 | 0 | if (MaybeDestroy(TNetAddr)) { |
316 | 0 | new (mozilla::KnownNotNull, ptr_NetAddr()) NetAddr; |
317 | 0 | } |
318 | 0 | (*(ptr_NetAddr())) = aRhs; |
319 | 0 | mType = TNetAddr; |
320 | 0 | return (*(this)); |
321 | 0 | } |
322 | | |
323 | | auto UDPSocketAddr::operator=(NetAddr&& aRhs) -> UDPSocketAddr& |
324 | 0 | { |
325 | 0 | if (MaybeDestroy(TNetAddr)) { |
326 | 0 | new (mozilla::KnownNotNull, ptr_NetAddr()) NetAddr; |
327 | 0 | } |
328 | 0 | (*(ptr_NetAddr())) = std::move(aRhs); |
329 | 0 | mType = TNetAddr; |
330 | 0 | return (*(this)); |
331 | 0 | } |
332 | | |
333 | | auto UDPSocketAddr::operator=(const UDPSocketAddr& aRhs) -> UDPSocketAddr& |
334 | 0 | { |
335 | 0 | (aRhs).AssertSanity(); |
336 | 0 | Type t = (aRhs).type(); |
337 | 0 | switch (t) { |
338 | 0 | case TUDPAddressInfo: |
339 | 0 | { |
340 | 0 | if (MaybeDestroy(t)) { |
341 | 0 | new (mozilla::KnownNotNull, ptr_UDPAddressInfo()) UDPAddressInfo; |
342 | 0 | } |
343 | 0 | (*(ptr_UDPAddressInfo())) = (aRhs).get_UDPAddressInfo(); |
344 | 0 | break; |
345 | 0 | } |
346 | 0 | case TNetAddr: |
347 | 0 | { |
348 | 0 | if (MaybeDestroy(t)) { |
349 | 0 | new (mozilla::KnownNotNull, ptr_NetAddr()) NetAddr; |
350 | 0 | } |
351 | 0 | (*(ptr_NetAddr())) = (aRhs).get_NetAddr(); |
352 | 0 | break; |
353 | 0 | } |
354 | 0 | case T__None: |
355 | 0 | { |
356 | 0 | static_cast<void>(MaybeDestroy(t)); |
357 | 0 | break; |
358 | 0 | } |
359 | 0 | default: |
360 | 0 | { |
361 | 0 | mozilla::ipc::LogicError("unreached"); |
362 | 0 | break; |
363 | 0 | } |
364 | 0 | } |
365 | 0 | mType = t; |
366 | 0 | return (*(this)); |
367 | 0 | } |
368 | | |
369 | | auto UDPSocketAddr::operator=(UDPSocketAddr&& aRhs) -> UDPSocketAddr& |
370 | 0 | { |
371 | 0 | (aRhs).AssertSanity(); |
372 | 0 | Type t = (aRhs).type(); |
373 | 0 | switch (t) { |
374 | 0 | case TUDPAddressInfo: |
375 | 0 | { |
376 | 0 | if (MaybeDestroy(t)) { |
377 | 0 | new (mozilla::KnownNotNull, ptr_UDPAddressInfo()) UDPAddressInfo; |
378 | 0 | } |
379 | 0 | (*(ptr_UDPAddressInfo())) = std::move((aRhs).get_UDPAddressInfo()); |
380 | 0 | static_cast<void>((aRhs).MaybeDestroy(T__None)); |
381 | 0 | break; |
382 | 0 | } |
383 | 0 | case TNetAddr: |
384 | 0 | { |
385 | 0 | if (MaybeDestroy(t)) { |
386 | 0 | new (mozilla::KnownNotNull, ptr_NetAddr()) NetAddr; |
387 | 0 | } |
388 | 0 | (*(ptr_NetAddr())) = std::move((aRhs).get_NetAddr()); |
389 | 0 | static_cast<void>((aRhs).MaybeDestroy(T__None)); |
390 | 0 | break; |
391 | 0 | } |
392 | 0 | case T__None: |
393 | 0 | { |
394 | 0 | static_cast<void>(MaybeDestroy(t)); |
395 | 0 | break; |
396 | 0 | } |
397 | 0 | default: |
398 | 0 | { |
399 | 0 | mozilla::ipc::LogicError("unreached"); |
400 | 0 | break; |
401 | 0 | } |
402 | 0 | } |
403 | 0 | (aRhs).mType = T__None; |
404 | 0 | mType = t; |
405 | 0 | return (*(this)); |
406 | 0 | } |
407 | | |
408 | | auto UDPSocketAddr::operator==(const UDPAddressInfo& aRhs) const -> bool |
409 | 0 | { |
410 | 0 | return (get_UDPAddressInfo()) == (aRhs); |
411 | 0 | } |
412 | | |
413 | | auto UDPSocketAddr::operator==(const NetAddr& aRhs) const -> bool |
414 | 0 | { |
415 | 0 | return (get_NetAddr()) == (aRhs); |
416 | 0 | } |
417 | | |
418 | | auto UDPSocketAddr::operator==(const UDPSocketAddr& aRhs) const -> bool |
419 | 0 | { |
420 | 0 | if ((type()) != ((aRhs).type())) { |
421 | 0 | return false; |
422 | 0 | } |
423 | 0 | |
424 | 0 | switch (type()) { |
425 | 0 | case TUDPAddressInfo: |
426 | 0 | { |
427 | 0 | return (get_UDPAddressInfo()) == ((aRhs).get_UDPAddressInfo()); |
428 | 0 | } |
429 | 0 | case TNetAddr: |
430 | 0 | { |
431 | 0 | return (get_NetAddr()) == ((aRhs).get_NetAddr()); |
432 | 0 | } |
433 | 0 | default: |
434 | 0 | { |
435 | 0 | mozilla::ipc::LogicError("unreached"); |
436 | 0 | return false; |
437 | 0 | } |
438 | 0 | } |
439 | 0 | } |
440 | | |
441 | | auto UDPSocketAddr::get(UDPAddressInfo* aOutValue) const -> void |
442 | 0 | { |
443 | 0 | (*(aOutValue)) = get_UDPAddressInfo(); |
444 | 0 | } |
445 | | |
446 | | auto UDPSocketAddr::get(NetAddr* aOutValue) const -> void |
447 | 0 | { |
448 | 0 | (*(aOutValue)) = get_NetAddr(); |
449 | 0 | } |
450 | | |
451 | | |
452 | | namespace mozilla { |
453 | | namespace ipc { |
454 | | auto IPDLParamTraits<UDPSocketAddr>::Write( |
455 | | IPC::Message* aMsg, |
456 | | mozilla::ipc::IProtocol* aActor, |
457 | | const paramType& aVar) -> void |
458 | | { |
459 | | typedef UDPSocketAddr union__; |
460 | | int type; |
461 | | type = (aVar).type(); |
462 | | WriteIPDLParam(aMsg, aActor, type); |
463 | | // Sentinel = 'UDPSocketAddr' |
464 | | (aMsg)->WriteSentinel(1003977814); |
465 | | |
466 | | switch (type) { |
467 | | case union__::TUDPAddressInfo: |
468 | | { |
469 | | WriteIPDLParam(aMsg, aActor, (aVar).get_UDPAddressInfo()); |
470 | | // Sentinel = 'TUDPAddressInfo' |
471 | | (aMsg)->WriteSentinel(3791295352); |
472 | | return; |
473 | | } |
474 | | case union__::TNetAddr: |
475 | | { |
476 | | WriteIPDLParam(aMsg, aActor, (aVar).get_NetAddr()); |
477 | | // Sentinel = 'TNetAddr' |
478 | | (aMsg)->WriteSentinel(1128270888); |
479 | | return; |
480 | | } |
481 | | default: |
482 | | { |
483 | | (aActor)->FatalError("unknown union type"); |
484 | | return; |
485 | | } |
486 | | } |
487 | | } |
488 | | |
489 | | auto IPDLParamTraits<UDPSocketAddr>::Read( |
490 | | const IPC::Message* aMsg, |
491 | | PickleIterator* aIter, |
492 | | mozilla::ipc::IProtocol* aActor, |
493 | | paramType* aVar) -> bool |
494 | 0 | { |
495 | 0 | typedef UDPSocketAddr union__; |
496 | 0 | int type; |
497 | 0 | if ((!(ReadIPDLParam(aMsg, aIter, aActor, (&(type)))))) { |
498 | 0 | (aActor)->FatalError("Error deserializing type of union UDPSocketAddr"); |
499 | 0 | return false; |
500 | 0 | } |
501 | 0 | // Sentinel = 'UDPSocketAddr' |
502 | 0 | if ((!((aMsg)->ReadSentinel(aIter, 1003977814)))) { |
503 | 0 | mozilla::ipc::SentinelReadError("Error deserializing type of union UDPSocketAddr"); |
504 | 0 | return false; |
505 | 0 | } |
506 | 0 | |
507 | 0 | switch (type) { |
508 | 0 | case union__::TUDPAddressInfo: |
509 | 0 | { |
510 | 0 | UDPAddressInfo tmp = UDPAddressInfo(); |
511 | 0 | (*(aVar)) = tmp; |
512 | 0 | if ((!(ReadIPDLParam(aMsg, aIter, aActor, (&((aVar)->get_UDPAddressInfo())))))) { |
513 | 0 | (aActor)->FatalError("Error deserializing variant TUDPAddressInfo of union UDPSocketAddr"); |
514 | 0 | return false; |
515 | 0 | } |
516 | 0 | // Sentinel = 'TUDPAddressInfo' |
517 | 0 | if ((!((aMsg)->ReadSentinel(aIter, 3791295352)))) { |
518 | 0 | mozilla::ipc::SentinelReadError("Error deserializing variant TUDPAddressInfo of union UDPSocketAddr"); |
519 | 0 | return false; |
520 | 0 | } |
521 | 0 | return true; |
522 | 0 | } |
523 | 0 | case union__::TNetAddr: |
524 | 0 | { |
525 | 0 | mozilla::net::NetAddr tmp = mozilla::net::NetAddr(); |
526 | 0 | (*(aVar)) = tmp; |
527 | 0 | if ((!(ReadIPDLParam(aMsg, aIter, aActor, (&((aVar)->get_NetAddr())))))) { |
528 | 0 | (aActor)->FatalError("Error deserializing variant TNetAddr of union UDPSocketAddr"); |
529 | 0 | return false; |
530 | 0 | } |
531 | 0 | // Sentinel = 'TNetAddr' |
532 | 0 | if ((!((aMsg)->ReadSentinel(aIter, 1128270888)))) { |
533 | 0 | mozilla::ipc::SentinelReadError("Error deserializing variant TNetAddr of union UDPSocketAddr"); |
534 | 0 | return false; |
535 | 0 | } |
536 | 0 | return true; |
537 | 0 | } |
538 | 0 | default: |
539 | 0 | { |
540 | 0 | (aActor)->FatalError("unknown union type"); |
541 | 0 | return false; |
542 | 0 | } |
543 | 0 | } |
544 | 0 | } |
545 | | |
546 | | } // namespace ipc |
547 | | } // namespace mozilla |
548 | | |
549 | | //----------------------------------------------------------------------------- |
550 | | // Method definitions for the IPDL type |union UDPData| |
551 | | // |
552 | | auto UDPData::MaybeDestroy(Type aNewType) -> bool |
553 | 0 | { |
554 | 0 | if ((mType) == (T__None)) { |
555 | 0 | return true; |
556 | 0 | } |
557 | 0 | if ((mType) == (aNewType)) { |
558 | 0 | return false; |
559 | 0 | } |
560 | 0 | switch (mType) { |
561 | 0 | case TArrayOfuint8_t: |
562 | 0 | { |
563 | 0 | (ptr_ArrayOfuint8_t())->~ArrayOfuint8_t__tdef(); |
564 | 0 | break; |
565 | 0 | } |
566 | 0 | case TIPCStream: |
567 | 0 | { |
568 | 0 | (ptr_IPCStream())->~IPCStream__tdef(); |
569 | 0 | break; |
570 | 0 | } |
571 | 0 | default: |
572 | 0 | { |
573 | 0 | mozilla::ipc::LogicError("not reached"); |
574 | 0 | break; |
575 | 0 | } |
576 | 0 | } |
577 | 0 | return true; |
578 | 0 | } |
579 | | |
580 | | MOZ_IMPLICIT UDPData::UDPData(const nsTArray<uint8_t>& aOther) |
581 | 0 | { |
582 | 0 | new (mozilla::KnownNotNull, ptr_ArrayOfuint8_t()) nsTArray<uint8_t>(aOther); |
583 | 0 | mType = TArrayOfuint8_t; |
584 | 0 | } |
585 | | |
586 | | MOZ_IMPLICIT UDPData::UDPData(nsTArray<uint8_t>&& aOther) |
587 | 0 | { |
588 | 0 | new (mozilla::KnownNotNull, ptr_ArrayOfuint8_t()) nsTArray<uint8_t>(std::move(aOther)); |
589 | 0 | mType = TArrayOfuint8_t; |
590 | 0 | } |
591 | | |
592 | | MOZ_IMPLICIT UDPData::UDPData(const IPCStream& aOther) |
593 | 0 | { |
594 | 0 | new (mozilla::KnownNotNull, ptr_IPCStream()) IPCStream(aOther); |
595 | 0 | mType = TIPCStream; |
596 | 0 | } |
597 | | |
598 | | MOZ_IMPLICIT UDPData::UDPData(IPCStream&& aOther) |
599 | 0 | { |
600 | 0 | new (mozilla::KnownNotNull, ptr_IPCStream()) IPCStream(std::move(aOther)); |
601 | 0 | mType = TIPCStream; |
602 | 0 | } |
603 | | |
604 | | MOZ_IMPLICIT UDPData::UDPData(const UDPData& aOther) |
605 | 0 | { |
606 | 0 | (aOther).AssertSanity(); |
607 | 0 | switch ((aOther).type()) { |
608 | 0 | case TArrayOfuint8_t: |
609 | 0 | { |
610 | 0 | new (mozilla::KnownNotNull, ptr_ArrayOfuint8_t()) nsTArray<uint8_t>((aOther).get_ArrayOfuint8_t()); |
611 | 0 | break; |
612 | 0 | } |
613 | 0 | case TIPCStream: |
614 | 0 | { |
615 | 0 | new (mozilla::KnownNotNull, ptr_IPCStream()) IPCStream((aOther).get_IPCStream()); |
616 | 0 | break; |
617 | 0 | } |
618 | 0 | case T__None: |
619 | 0 | { |
620 | 0 | break; |
621 | 0 | } |
622 | 0 | default: |
623 | 0 | { |
624 | 0 | mozilla::ipc::LogicError("unreached"); |
625 | 0 | return; |
626 | 0 | } |
627 | 0 | } |
628 | 0 | mType = (aOther).type(); |
629 | 0 | } |
630 | | |
631 | | MOZ_IMPLICIT UDPData::UDPData(UDPData&& aOther) |
632 | 0 | { |
633 | 0 | (aOther).AssertSanity(); |
634 | 0 | Type t = (aOther).type(); |
635 | 0 | switch (t) { |
636 | 0 | case TArrayOfuint8_t: |
637 | 0 | { |
638 | 0 | new (mozilla::KnownNotNull, ptr_ArrayOfuint8_t()) nsTArray<uint8_t>(std::move((aOther).get_ArrayOfuint8_t())); |
639 | 0 | static_cast<void>((aOther).MaybeDestroy(T__None)); |
640 | 0 | break; |
641 | 0 | } |
642 | 0 | case TIPCStream: |
643 | 0 | { |
644 | 0 | new (mozilla::KnownNotNull, ptr_IPCStream()) IPCStream(std::move((aOther).get_IPCStream())); |
645 | 0 | static_cast<void>((aOther).MaybeDestroy(T__None)); |
646 | 0 | break; |
647 | 0 | } |
648 | 0 | case T__None: |
649 | 0 | { |
650 | 0 | break; |
651 | 0 | } |
652 | 0 | default: |
653 | 0 | { |
654 | 0 | mozilla::ipc::LogicError("unreached"); |
655 | 0 | return; |
656 | 0 | } |
657 | 0 | } |
658 | 0 | (aOther).mType = T__None; |
659 | 0 | mType = t; |
660 | 0 | } |
661 | | |
662 | | UDPData::~UDPData() |
663 | 0 | { |
664 | 0 | static_cast<void>(MaybeDestroy(T__None)); |
665 | 0 | } |
666 | | |
667 | | auto UDPData::operator=(const nsTArray<uint8_t>& aRhs) -> UDPData& |
668 | 0 | { |
669 | 0 | if (MaybeDestroy(TArrayOfuint8_t)) { |
670 | 0 | new (mozilla::KnownNotNull, ptr_ArrayOfuint8_t()) nsTArray<uint8_t>; |
671 | 0 | } |
672 | 0 | (*(ptr_ArrayOfuint8_t())) = aRhs; |
673 | 0 | mType = TArrayOfuint8_t; |
674 | 0 | return (*(this)); |
675 | 0 | } |
676 | | |
677 | | auto UDPData::operator=(nsTArray<uint8_t>&& aRhs) -> UDPData& |
678 | 0 | { |
679 | 0 | if (MaybeDestroy(TArrayOfuint8_t)) { |
680 | 0 | new (mozilla::KnownNotNull, ptr_ArrayOfuint8_t()) nsTArray<uint8_t>; |
681 | 0 | } |
682 | 0 | (*(ptr_ArrayOfuint8_t())) = std::move(aRhs); |
683 | 0 | mType = TArrayOfuint8_t; |
684 | 0 | return (*(this)); |
685 | 0 | } |
686 | | |
687 | | auto UDPData::operator=(const IPCStream& aRhs) -> UDPData& |
688 | 0 | { |
689 | 0 | if (MaybeDestroy(TIPCStream)) { |
690 | 0 | new (mozilla::KnownNotNull, ptr_IPCStream()) IPCStream; |
691 | 0 | } |
692 | 0 | (*(ptr_IPCStream())) = aRhs; |
693 | 0 | mType = TIPCStream; |
694 | 0 | return (*(this)); |
695 | 0 | } |
696 | | |
697 | | auto UDPData::operator=(IPCStream&& aRhs) -> UDPData& |
698 | 0 | { |
699 | 0 | if (MaybeDestroy(TIPCStream)) { |
700 | 0 | new (mozilla::KnownNotNull, ptr_IPCStream()) IPCStream; |
701 | 0 | } |
702 | 0 | (*(ptr_IPCStream())) = std::move(aRhs); |
703 | 0 | mType = TIPCStream; |
704 | 0 | return (*(this)); |
705 | 0 | } |
706 | | |
707 | | auto UDPData::operator=(const UDPData& aRhs) -> UDPData& |
708 | 0 | { |
709 | 0 | (aRhs).AssertSanity(); |
710 | 0 | Type t = (aRhs).type(); |
711 | 0 | switch (t) { |
712 | 0 | case TArrayOfuint8_t: |
713 | 0 | { |
714 | 0 | if (MaybeDestroy(t)) { |
715 | 0 | new (mozilla::KnownNotNull, ptr_ArrayOfuint8_t()) nsTArray<uint8_t>; |
716 | 0 | } |
717 | 0 | (*(ptr_ArrayOfuint8_t())) = (aRhs).get_ArrayOfuint8_t(); |
718 | 0 | break; |
719 | 0 | } |
720 | 0 | case TIPCStream: |
721 | 0 | { |
722 | 0 | if (MaybeDestroy(t)) { |
723 | 0 | new (mozilla::KnownNotNull, ptr_IPCStream()) IPCStream; |
724 | 0 | } |
725 | 0 | (*(ptr_IPCStream())) = (aRhs).get_IPCStream(); |
726 | 0 | break; |
727 | 0 | } |
728 | 0 | case T__None: |
729 | 0 | { |
730 | 0 | static_cast<void>(MaybeDestroy(t)); |
731 | 0 | break; |
732 | 0 | } |
733 | 0 | default: |
734 | 0 | { |
735 | 0 | mozilla::ipc::LogicError("unreached"); |
736 | 0 | break; |
737 | 0 | } |
738 | 0 | } |
739 | 0 | mType = t; |
740 | 0 | return (*(this)); |
741 | 0 | } |
742 | | |
743 | | auto UDPData::operator=(UDPData&& aRhs) -> UDPData& |
744 | 0 | { |
745 | 0 | (aRhs).AssertSanity(); |
746 | 0 | Type t = (aRhs).type(); |
747 | 0 | switch (t) { |
748 | 0 | case TArrayOfuint8_t: |
749 | 0 | { |
750 | 0 | if (MaybeDestroy(t)) { |
751 | 0 | new (mozilla::KnownNotNull, ptr_ArrayOfuint8_t()) nsTArray<uint8_t>; |
752 | 0 | } |
753 | 0 | (*(ptr_ArrayOfuint8_t())) = std::move((aRhs).get_ArrayOfuint8_t()); |
754 | 0 | static_cast<void>((aRhs).MaybeDestroy(T__None)); |
755 | 0 | break; |
756 | 0 | } |
757 | 0 | case TIPCStream: |
758 | 0 | { |
759 | 0 | if (MaybeDestroy(t)) { |
760 | 0 | new (mozilla::KnownNotNull, ptr_IPCStream()) IPCStream; |
761 | 0 | } |
762 | 0 | (*(ptr_IPCStream())) = std::move((aRhs).get_IPCStream()); |
763 | 0 | static_cast<void>((aRhs).MaybeDestroy(T__None)); |
764 | 0 | break; |
765 | 0 | } |
766 | 0 | case T__None: |
767 | 0 | { |
768 | 0 | static_cast<void>(MaybeDestroy(t)); |
769 | 0 | break; |
770 | 0 | } |
771 | 0 | default: |
772 | 0 | { |
773 | 0 | mozilla::ipc::LogicError("unreached"); |
774 | 0 | break; |
775 | 0 | } |
776 | 0 | } |
777 | 0 | (aRhs).mType = T__None; |
778 | 0 | mType = t; |
779 | 0 | return (*(this)); |
780 | 0 | } |
781 | | |
782 | | auto UDPData::operator==(const nsTArray<uint8_t>& aRhs) const -> bool |
783 | 0 | { |
784 | 0 | return (get_ArrayOfuint8_t()) == (aRhs); |
785 | 0 | } |
786 | | |
787 | | auto UDPData::operator==(const IPCStream& aRhs) const -> bool |
788 | 0 | { |
789 | 0 | return (get_IPCStream()) == (aRhs); |
790 | 0 | } |
791 | | |
792 | | auto UDPData::operator==(const UDPData& aRhs) const -> bool |
793 | 0 | { |
794 | 0 | if ((type()) != ((aRhs).type())) { |
795 | 0 | return false; |
796 | 0 | } |
797 | 0 | |
798 | 0 | switch (type()) { |
799 | 0 | case TArrayOfuint8_t: |
800 | 0 | { |
801 | 0 | return (get_ArrayOfuint8_t()) == ((aRhs).get_ArrayOfuint8_t()); |
802 | 0 | } |
803 | 0 | case TIPCStream: |
804 | 0 | { |
805 | 0 | return (get_IPCStream()) == ((aRhs).get_IPCStream()); |
806 | 0 | } |
807 | 0 | default: |
808 | 0 | { |
809 | 0 | mozilla::ipc::LogicError("unreached"); |
810 | 0 | return false; |
811 | 0 | } |
812 | 0 | } |
813 | 0 | } |
814 | | |
815 | | auto UDPData::get(nsTArray<uint8_t>* aOutValue) const -> void |
816 | 0 | { |
817 | 0 | (*(aOutValue)) = get_ArrayOfuint8_t(); |
818 | 0 | } |
819 | | |
820 | | auto UDPData::get(IPCStream* aOutValue) const -> void |
821 | 0 | { |
822 | 0 | (*(aOutValue)) = get_IPCStream(); |
823 | 0 | } |
824 | | |
825 | | |
826 | | namespace mozilla { |
827 | | namespace ipc { |
828 | | auto IPDLParamTraits<UDPData>::Write( |
829 | | IPC::Message* aMsg, |
830 | | mozilla::ipc::IProtocol* aActor, |
831 | | const paramType& aVar) -> void |
832 | | { |
833 | | typedef UDPData union__; |
834 | | int type; |
835 | | type = (aVar).type(); |
836 | | WriteIPDLParam(aMsg, aActor, type); |
837 | | // Sentinel = 'UDPData' |
838 | | (aMsg)->WriteSentinel(2865939838); |
839 | | |
840 | | switch (type) { |
841 | | case union__::TArrayOfuint8_t: |
842 | | { |
843 | | WriteIPDLParam(aMsg, aActor, (aVar).get_ArrayOfuint8_t()); |
844 | | // Sentinel = 'TArrayOfuint8_t' |
845 | | (aMsg)->WriteSentinel(430000978); |
846 | | return; |
847 | | } |
848 | | case union__::TIPCStream: |
849 | | { |
850 | | WriteIPDLParam(aMsg, aActor, (aVar).get_IPCStream()); |
851 | | // Sentinel = 'TIPCStream' |
852 | | (aMsg)->WriteSentinel(40701900); |
853 | | return; |
854 | | } |
855 | | default: |
856 | | { |
857 | | (aActor)->FatalError("unknown union type"); |
858 | | return; |
859 | | } |
860 | | } |
861 | | } |
862 | | |
863 | | auto IPDLParamTraits<UDPData>::Read( |
864 | | const IPC::Message* aMsg, |
865 | | PickleIterator* aIter, |
866 | | mozilla::ipc::IProtocol* aActor, |
867 | | paramType* aVar) -> bool |
868 | 0 | { |
869 | 0 | typedef UDPData union__; |
870 | 0 | int type; |
871 | 0 | if ((!(ReadIPDLParam(aMsg, aIter, aActor, (&(type)))))) { |
872 | 0 | (aActor)->FatalError("Error deserializing type of union UDPData"); |
873 | 0 | return false; |
874 | 0 | } |
875 | 0 | // Sentinel = 'UDPData' |
876 | 0 | if ((!((aMsg)->ReadSentinel(aIter, 2865939838)))) { |
877 | 0 | mozilla::ipc::SentinelReadError("Error deserializing type of union UDPData"); |
878 | 0 | return false; |
879 | 0 | } |
880 | 0 | |
881 | 0 | switch (type) { |
882 | 0 | case union__::TArrayOfuint8_t: |
883 | 0 | { |
884 | 0 | nsTArray<uint8_t> tmp; |
885 | 0 | (*(aVar)) = tmp; |
886 | 0 | if ((!(ReadIPDLParam(aMsg, aIter, aActor, (&((aVar)->get_ArrayOfuint8_t())))))) { |
887 | 0 | (aActor)->FatalError("Error deserializing variant TArrayOfuint8_t of union UDPData"); |
888 | 0 | return false; |
889 | 0 | } |
890 | 0 | // Sentinel = 'TArrayOfuint8_t' |
891 | 0 | if ((!((aMsg)->ReadSentinel(aIter, 430000978)))) { |
892 | 0 | mozilla::ipc::SentinelReadError("Error deserializing variant TArrayOfuint8_t of union UDPData"); |
893 | 0 | return false; |
894 | 0 | } |
895 | 0 | return true; |
896 | 0 | } |
897 | 0 | case union__::TIPCStream: |
898 | 0 | { |
899 | 0 | mozilla::ipc::IPCStream tmp = mozilla::ipc::IPCStream(); |
900 | 0 | (*(aVar)) = tmp; |
901 | 0 | if ((!(ReadIPDLParam(aMsg, aIter, aActor, (&((aVar)->get_IPCStream())))))) { |
902 | 0 | (aActor)->FatalError("Error deserializing variant TIPCStream of union UDPData"); |
903 | 0 | return false; |
904 | 0 | } |
905 | 0 | // Sentinel = 'TIPCStream' |
906 | 0 | if ((!((aMsg)->ReadSentinel(aIter, 40701900)))) { |
907 | 0 | mozilla::ipc::SentinelReadError("Error deserializing variant TIPCStream of union UDPData"); |
908 | 0 | return false; |
909 | 0 | } |
910 | 0 | return true; |
911 | 0 | } |
912 | 0 | default: |
913 | 0 | { |
914 | 0 | (aActor)->FatalError("unknown union type"); |
915 | 0 | return false; |
916 | 0 | } |
917 | 0 | } |
918 | 0 | } |
919 | | |
920 | | } // namespace ipc |
921 | | } // namespace mozilla |