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