folly/folly/IPAddressV6.cpp

/*
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include <folly/IPAddressV6.h>

#include <algorithm>
#include <ostream>
#include <string>

#include <fmt/core.h>

#include <folly/IPAddress.h>
#include <folly/IPAddressV4.h>
#include <folly/MacAddress.h>
#include <folly/ScopeGuard.h>
#include <folly/String.h>
#include <folly/detail/IPAddressSource.h>

#ifdef _WIN32
// Because of the massive pain that is libnl, this can't go into the socket
// portability header as you can't include <linux/if.h> and <net/if.h> in
// the same translation unit without getting errors -_-...
#include <iphlpapi.h> // @manual
#include <ntddndis.h> // @manual

// Alias the max size of an interface name to what posix expects.
#define IFNAMSIZ
#else
#include <net/if.h>
#endif

ostream;
string;

namespace folly {

// public static const
const uint32_t IPAddressV6::PREFIX_TEREDO =;
const uint32_t IPAddressV6::PREFIX_6TO4 =;

// free functions
size_t hash_value(const IPAddressV6& addr) {}
ostream& operator<<(ostream& os, const IPAddressV6& addr) {}
void toAppend(IPAddressV6 addr, string* result) {}
void toAppend(IPAddressV6 addr, fbstring* result) {}

bool IPAddressV6::validate(StringPiece ip) noexcept {}

// public default constructor
IPAddressV6::IPAddressV6() = default;

// public string constructor
IPAddressV6::IPAddressV6(StringPiece addr) {}

Expected<IPAddressV6, IPAddressFormatError> IPAddressV6::tryFromString(
    StringPiece str) noexcept {}

// in6_addr constructor
IPAddressV6::IPAddressV6(const in6_addr& src) noexcept :{}

// sockaddr_in6 constructor
IPAddressV6::IPAddressV6(const sockaddr_in6& src) noexcept
    :{}

// ByteArray16 constructor
IPAddressV6::IPAddressV6(const ByteArray16& src) noexcept :{}

// link-local constructor
IPAddressV6::IPAddressV6(LinkLocalTag, MacAddress mac) :{}

IPAddressV6::AddressStorage::AddressStorage(MacAddress mac) {}

Optional<MacAddress> IPAddressV6::getMacAddressFromLinkLocal() const {}

Optional<MacAddress> IPAddressV6::getMacAddressFromEUI64() const {}

IPAddressV6 IPAddressV6::fromBinary(ByteRange bytes) {}

Expected<IPAddressV6, IPAddressFormatError> IPAddressV6::tryFromBinary(
    ByteRange bytes) noexcept {}

Expected<Unit, IPAddressFormatError> IPAddressV6::trySetFromBinary(
    ByteRange bytes) noexcept {}

// static
IPAddressV6 IPAddressV6::fromInverseArpaName(const std::string& arpaname) {}

// public
IPAddressV4 IPAddressV6::createIPv4() const {}

// convert two uint8_t bytes into a uint16_t as hibyte.lobyte
static inline uint16_t unpack(uint8_t lobyte, uint8_t hibyte) {}

// given a src string, unpack count*2 bytes into dest
// dest must have as much storage as count
static inline void unpackInto(
    const unsigned char* src, uint16_t* dest, size_t count) {}

// public
IPAddressV4 IPAddressV6::getIPv4For6To4() const {}

// public
bool IPAddressV6::isIPv4Mapped() const {}

// public
IPAddressV6::Type IPAddressV6::type() const {}

// public
string IPAddressV6::toJson() const {}

// public
size_t IPAddressV6::hash() const {}

// public
bool IPAddressV6::inSubnet(StringPiece cidrNetwork) const {}

// public
bool IPAddressV6::inSubnetWithMask(
    const IPAddressV6& subnet, const ByteArray16& cidrMask) const {}

// public
bool IPAddressV6::isLoopback() const {}

bool IPAddressV6::isRoutable() const {}

bool IPAddressV6::isLinkLocalBroadcast() const {}

// public
bool IPAddressV6::isPrivate() const {}

// public
bool IPAddressV6::isLinkLocal() const {}

bool IPAddressV6::isMulticast() const {}

uint8_t IPAddressV6::getMulticastFlags() const {}

uint8_t IPAddressV6::getMulticastScope() const {}

IPAddressV6 IPAddressV6::getSolicitedNodeAddress() const {}

// public
IPAddressV6 IPAddressV6::mask(size_t numBits) const {}

// public
string IPAddressV6::str() const {}

// public
string IPAddressV6::toFullyQualified() const {}

// public
void IPAddressV6::toFullyQualifiedAppend(std::string& out) const {}

// public
string IPAddressV6::toInverseArpaName() const {}

// public
uint8_t IPAddressV6::getNthMSByte(size_t byteIndex) const {}

// protected
ByteArray16 IPAddressV6::fetchMask(size_t numBits) {}

// public static
CIDRNetworkV6 IPAddressV6::longestCommonPrefix(
    const CIDRNetworkV6& one, const CIDRNetworkV6& two) {}

// protected
bool IPAddressV6::inBinarySubnet(
    const std::array<uint8_t, 2> addr, size_t numBits) const {}
} // namespace folly