Sha256: 06e1821a8f1220d4defb746ea0df46e16a1d1703ae8c6c0a3017addd70ba635b

Contents?: true

Size: 1.71 KB

Versions: 2

Compression:

Stored size: 1.71 KB

Contents

/**
 * @file
 * Declares the POSIX networking fact resolver.
 */
#pragma once

#include "../resolvers/networking_resolver.hpp"
#include <sys/socket.h>

namespace facter { namespace facts { namespace posix {

    /**
     * Responsible for resolving networking facts.
     */
    struct networking_resolver : resolvers::networking_resolver
    {
        /**
         * Utility function to convert a socket address to a IPv4 or IPv6 string representation.
         * @param addr The socket address to convert to a string.
         * @param mask The mask to apply to the address.
         * @return Returns the IPv4 or IPv6 representation or an empty string if the family isn't supported.
         */
        std::string address_to_string(sockaddr const* addr, sockaddr const* mask = nullptr) const;

     protected:
        /**
         * Determines if the given sock address is a link layer address.
         * @param addr The socket address to check.
         * @returns Returns true if the socket address is a link layer address or false if it is not.
         */
        virtual bool is_link_address(sockaddr const* addr) const = 0;

        /**
         * Gets the bytes of the link address.
         * @param addr The socket address representing the link address.
         * @return Returns a pointer to the address bytes or nullptr if not a link address.
         */
        virtual uint8_t const* get_link_address_bytes(sockaddr const* addr) const = 0;

        /**
         * Collects the resolver data.
         * @param facts The fact collection that is resolving facts.
         * @return Returns the resolver data.
         */
        virtual data collect_data(collection& facts) override;
    };

}}}  // namespace facter::facts::posix

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
facter-3.11.0.cfacter.20180319 ext/facter/facter/lib/inc/internal/facts/posix/networking_resolver.hpp
cfacter-3.11.0.rc.20180314 ext/facter/facter/lib/inc/internal/facts/posix/networking_resolver.hpp