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 [DartPackage="mojo_services"] | 5 [DartPackage="mojo_services"] |
6 module mojo; | 6 module mojo; |
7 | 7 |
8 enum NetAddressFamily { | 8 enum NetAddressFamily { |
9 UNSPECIFIED, | 9 UNSPECIFIED, |
10 IPV4, | 10 IPV4, |
11 IPV6 | 11 IPV6, |
12 }; | 12 }; |
13 | 13 |
14 struct NetAddressIPv4 { | 14 struct NetAddressIPv4 { |
15 // The port number. This is in the local machine's endianness. | 15 // The port number. This is in the local machine's endianness. |
16 uint16 port; | 16 uint16 port; |
17 | 17 |
18 // The address is expressed in network byte order, so the most significant | 18 // The address is expressed in network byte order, so the most significant |
19 // byte ("127" in the address "127.0.0.1") will be at index 0. | 19 // byte ("127" in the address "127.0.0.1") will be at index 0. |
20 array<uint8, 4> addr; | 20 array<uint8, 4> addr; |
21 }; | 21 }; |
22 | 22 |
23 // All members are expressed in network byte order. | 23 // All members are expressed in network byte order. |
24 struct NetAddressIPv6 { | 24 struct NetAddressIPv6 { |
25 // The port number. This is in the local machine's endianness. | 25 // The port number. This is in the local machine's endianness. |
26 uint16 port; | 26 uint16 port; |
27 | 27 |
28 // The address is expressed in network byte order, so the most significant | 28 // The address is expressed in network byte order, so the most significant |
29 // byte is at index 0. | 29 // byte is at index 0. |
30 array<uint8, 16> addr; | 30 array<uint8, 16> addr; |
31 }; | 31 }; |
32 | 32 |
33 struct NetAddress { | 33 struct NetAddress { |
34 NetAddressFamily family = UNSPECIFIED; | 34 NetAddressFamily family = UNSPECIFIED; |
35 | 35 |
36 // At most one of the following fields is non-NULL depending on the value of | 36 // At most one of the following fields is non-NULL depending on the value of |
37 // |family|. | 37 // |family|. |
38 NetAddressIPv4? ipv4; | 38 NetAddressIPv4? ipv4; |
39 NetAddressIPv6? ipv6; | 39 NetAddressIPv6? ipv6; |
40 }; | 40 }; |
OLD | NEW |