OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 patch class RawServerSocket { | 5 patch class RawServerSocket { |
6 /* patch */ static Future<RawServerSocket> bind(address, | 6 /* patch */ static Future<RawServerSocket> bind(address, |
7 int port, | 7 int port, |
8 {int backlog: 0, | 8 {int backlog: 0, |
9 bool v6Only: false}) { | 9 bool v6Only: false}) { |
10 return _RawServerSocket.bind(address, port, backlog, v6Only); | 10 return _RawServerSocket.bind(address, port, backlog, v6Only); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 final String address; | 77 final String address; |
78 final String _host; | 78 final String _host; |
79 final Uint8List _in_addr; | 79 final Uint8List _in_addr; |
80 | 80 |
81 InternetAddressType get type => | 81 InternetAddressType get type => |
82 _in_addr.length == _IPV4_ADDR_LENGTH ? InternetAddressType.IP_V4 | 82 _in_addr.length == _IPV4_ADDR_LENGTH ? InternetAddressType.IP_V4 |
83 : InternetAddressType.IP_V6; | 83 : InternetAddressType.IP_V6; |
84 | 84 |
85 String get host => _host != null ? _host : address; | 85 String get host => _host != null ? _host : address; |
86 | 86 |
| 87 List<int> get rawAddress => new Uint8List.fromList(_in_addr); |
| 88 |
87 bool get isLoopback { | 89 bool get isLoopback { |
88 switch (type) { | 90 switch (type) { |
89 case InternetAddressType.IP_V4: | 91 case InternetAddressType.IP_V4: |
90 return _in_addr[0] == 127; | 92 return _in_addr[0] == 127; |
91 | 93 |
92 case InternetAddressType.IP_V6: | 94 case InternetAddressType.IP_V6: |
93 for (int i = 0; i < _IPV6_ADDR_LENGTH - 1; i++) { | 95 for (int i = 0; i < _IPV6_ADDR_LENGTH - 1; i++) { |
94 if (_in_addr[i] != 0) return false; | 96 if (_in_addr[i] != 0) return false; |
95 } | 97 } |
96 return _in_addr[_IPV6_ADDR_LENGTH - 1] == 1; | 98 return _in_addr[_IPV6_ADDR_LENGTH - 1] == 1; |
(...skipping 1492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1589 | 1591 |
1590 Datagram _makeDatagram(List<int> data, | 1592 Datagram _makeDatagram(List<int> data, |
1591 String address, | 1593 String address, |
1592 List<int> in_addr, | 1594 List<int> in_addr, |
1593 int port) { | 1595 int port) { |
1594 return new Datagram( | 1596 return new Datagram( |
1595 data, | 1597 data, |
1596 new _InternetAddress(address, null, in_addr), | 1598 new _InternetAddress(address, null, in_addr), |
1597 port); | 1599 port); |
1598 } | 1600 } |
OLD | NEW |