Chromium Code Reviews| Index: net/interfaces/ip_address_struct_traits.cc |
| diff --git a/net/interfaces/ip_address_struct_traits.cc b/net/interfaces/ip_address_struct_traits.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..4f1b11f3b6f69fb7a9a85e2b1981414018afdc7b |
| --- /dev/null |
| +++ b/net/interfaces/ip_address_struct_traits.cc |
| @@ -0,0 +1,20 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "net/interfaces/ip_address_struct_traits.h" |
| + |
| +namespace mojo { |
| +// static |
| +bool StructTraits<net::interfaces::IPAddressDataView, net::IPAddress>::Read( |
| + net::interfaces::IPAddressDataView data, |
| + net::IPAddress* out) { |
| + std::vector<uint8_t> bytes; |
| + if (!data.ReadAddress(&bytes)) |
| + return false; |
| + |
| + *out = net::IPAddress(bytes); |
| + return true; |
|
dcheng
2017/03/09 22:11:35
Should we check out->IsValid() here?
zhaobin
2017/03/09 22:21:05
Done.
|
| +} |
| + |
| +} // namespace mojo |