OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 library net_address_mojom; | 5 library net_address_mojom; |
6 import 'package:mojo/bindings.dart' as bindings; | 6 import 'package:mojo/bindings.dart' as bindings; |
7 | 7 |
8 | 8 |
9 class NetAddressFamily extends bindings.MojoEnum { | 9 class NetAddressFamily extends bindings.MojoEnum { |
10 static const NetAddressFamily unspecified = const NetAddressFamily._(0); | 10 static const NetAddressFamily unspecified = const NetAddressFamily._(0); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 69 |
70 class NetAddressIPv4 extends bindings.Struct { | 70 class NetAddressIPv4 extends bindings.Struct { |
71 static const List<bindings.StructDataHeader> kVersions = const [ | 71 static const List<bindings.StructDataHeader> kVersions = const [ |
72 const bindings.StructDataHeader(24, 0) | 72 const bindings.StructDataHeader(24, 0) |
73 ]; | 73 ]; |
74 int port = 0; | 74 int port = 0; |
75 List<int> addr = null; | 75 List<int> addr = null; |
76 | 76 |
77 NetAddressIPv4() : super(kVersions.last.size); | 77 NetAddressIPv4() : super(kVersions.last.size); |
78 | 78 |
| 79 NetAddressIPv4.init( |
| 80 int this.port, |
| 81 List<int> this.addr |
| 82 ) : super(kVersions.last.size); |
| 83 |
79 static NetAddressIPv4 deserialize(bindings.Message message) { | 84 static NetAddressIPv4 deserialize(bindings.Message message) { |
80 var decoder = new bindings.Decoder(message); | 85 var decoder = new bindings.Decoder(message); |
81 var result = decode(decoder); | 86 var result = decode(decoder); |
82 if (decoder.excessHandles != null) { | 87 if (decoder.excessHandles != null) { |
83 decoder.excessHandles.forEach((h) => h.close()); | 88 decoder.excessHandles.forEach((h) => h.close()); |
84 } | 89 } |
85 return result; | 90 return result; |
86 } | 91 } |
87 | 92 |
88 static NetAddressIPv4 decode(bindings.Decoder decoder0) { | 93 static NetAddressIPv4 decode(bindings.Decoder decoder0) { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 | 160 |
156 class NetAddressIPv6 extends bindings.Struct { | 161 class NetAddressIPv6 extends bindings.Struct { |
157 static const List<bindings.StructDataHeader> kVersions = const [ | 162 static const List<bindings.StructDataHeader> kVersions = const [ |
158 const bindings.StructDataHeader(24, 0) | 163 const bindings.StructDataHeader(24, 0) |
159 ]; | 164 ]; |
160 int port = 0; | 165 int port = 0; |
161 List<int> addr = null; | 166 List<int> addr = null; |
162 | 167 |
163 NetAddressIPv6() : super(kVersions.last.size); | 168 NetAddressIPv6() : super(kVersions.last.size); |
164 | 169 |
| 170 NetAddressIPv6.init( |
| 171 int this.port, |
| 172 List<int> this.addr |
| 173 ) : super(kVersions.last.size); |
| 174 |
165 static NetAddressIPv6 deserialize(bindings.Message message) { | 175 static NetAddressIPv6 deserialize(bindings.Message message) { |
166 var decoder = new bindings.Decoder(message); | 176 var decoder = new bindings.Decoder(message); |
167 var result = decode(decoder); | 177 var result = decode(decoder); |
168 if (decoder.excessHandles != null) { | 178 if (decoder.excessHandles != null) { |
169 decoder.excessHandles.forEach((h) => h.close()); | 179 decoder.excessHandles.forEach((h) => h.close()); |
170 } | 180 } |
171 return result; | 181 return result; |
172 } | 182 } |
173 | 183 |
174 static NetAddressIPv6 decode(bindings.Decoder decoder0) { | 184 static NetAddressIPv6 decode(bindings.Decoder decoder0) { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 class NetAddress extends bindings.Struct { | 252 class NetAddress extends bindings.Struct { |
243 static const List<bindings.StructDataHeader> kVersions = const [ | 253 static const List<bindings.StructDataHeader> kVersions = const [ |
244 const bindings.StructDataHeader(32, 0) | 254 const bindings.StructDataHeader(32, 0) |
245 ]; | 255 ]; |
246 NetAddressFamily family = new NetAddressFamily(0); | 256 NetAddressFamily family = new NetAddressFamily(0); |
247 NetAddressIPv4 ipv4 = null; | 257 NetAddressIPv4 ipv4 = null; |
248 NetAddressIPv6 ipv6 = null; | 258 NetAddressIPv6 ipv6 = null; |
249 | 259 |
250 NetAddress() : super(kVersions.last.size); | 260 NetAddress() : super(kVersions.last.size); |
251 | 261 |
| 262 NetAddress.init( |
| 263 NetAddressFamily this.family, |
| 264 NetAddressIPv4 this.ipv4, |
| 265 NetAddressIPv6 this.ipv6 |
| 266 ) : super(kVersions.last.size); |
| 267 |
252 static NetAddress deserialize(bindings.Message message) { | 268 static NetAddress deserialize(bindings.Message message) { |
253 var decoder = new bindings.Decoder(message); | 269 var decoder = new bindings.Decoder(message); |
254 var result = decode(decoder); | 270 var result = decode(decoder); |
255 if (decoder.excessHandles != null) { | 271 if (decoder.excessHandles != null) { |
256 decoder.excessHandles.forEach((h) => h.close()); | 272 decoder.excessHandles.forEach((h) => h.close()); |
257 } | 273 } |
258 return result; | 274 return result; |
259 } | 275 } |
260 | 276 |
261 static NetAddress decode(bindings.Decoder decoder0) { | 277 static NetAddress decode(bindings.Decoder decoder0) { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 Map map = new Map(); | 355 Map map = new Map(); |
340 map["family"] = family; | 356 map["family"] = family; |
341 map["ipv4"] = ipv4; | 357 map["ipv4"] = ipv4; |
342 map["ipv6"] = ipv6; | 358 map["ipv6"] = ipv6; |
343 return map; | 359 return map; |
344 } | 360 } |
345 } | 361 } |
346 | 362 |
347 | 363 |
348 | 364 |
OLD | NEW |