blob: c2ac2eaba8d9c5520e38451e4a05debec1805c14 [file] [log] [blame]
// Copyright 2017 The Fuchsia 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 "garnet/lib/inet/ip_port.h"
namespace inet {
IpPort::IpPort() : value_(0) {}
IpPort::IpPort(uint8_t b0, uint8_t b1) {
uint8_t* bytes = reinterpret_cast<uint8_t*>(&value_);
bytes[0] = b0;
bytes[1] = b1;
}
std::ostream& operator<<(std::ostream& os, IpPort value) {
if (!value.is_valid()) {
return os << "<invalid>";
}
return os << value.as_uint16_t();
}
} // namespace inet