<commit_before>#include <unordered_map>
#include <fmt/format.h>
#include <asio.hpp>
#include "dhcp_state.hpp"

struct interface_data
{
    interface_data(bool use_v4, bool use_v6) : use_dhcpv4(use_v4), use_dhcpv6(use_v6) {}
    std::unordered_multimap<std::string, std::unique_ptr<dhcpv6_entry>> duid_mapping;
    std::unordered_map<std::string, std::unique_ptr<dhcpv4_entry>> macaddr_mapping;
    std::vector<asio::ip::address_v4> gateway;
    std::vector<asio::ip::address_v6> dns6_servers;
    std::vector<asio::ip::address_v4> dns4_servers;
    std::vector<asio::ip::address_v6> ntp6_servers;
    std::vector<asio::ip::address_v4> ntp4_servers;
    std::vector<asio::ip::address_v6> ntp6_multicasts;
    std::vector<std::string> dns_search;
    std::vector<std::string> ntp6_fqdns;
    asio::ip::address_v4 subnet;
    asio::ip::address_v4 broadcast;
    std::vector<uint8_t> dns_search_blob;
    std::vector<uint8_t> ntp6_fqdns_blob;
    std::pair<asio::ip::address_v4, asio::ip::address_v4> dynamic_range;
    uint32_t dynamic_lifetime;
    uint8_t preference;
    bool use_dhcpv4:1;
    bool use_dhcpv6:1;
    bool use_dynamic_v4:1;
    bool use_dynamic_v6:1;
};

static std::unordered_map<std::string, interface_data> interface_state;

// Performs DNS label wire encoding cf RFC1035 3.1
// Allocates memory frequently in order to make correctness easier to
// verify, but at least in this program, it will called only at
// reconfiguration.
static std::vector<uint8_t> dns_label(const std::string &ds)
{<commit_msg>dhcp_state: interface_data should initialize all fields.<commit_after>#include <unordered_map>
#include <fmt/format.h>
#include <asio.hpp>
#include "dhcp_state.hpp"

struct interface_data
{
    interface_data(bool use_v4, bool use_v6)
        : dynamic_lifetime(0), preference(0), use_dhcpv4(use_v4), use_dhcpv6(use_v6),
          use_dynamic_v4(false), use_dynamic_v6(false) {}
    std::unordered_multimap<std::string, std::unique_ptr<dhcpv6_entry>> duid_mapping;
    std::unordered_map<std::string, std::unique_ptr<dhcpv4_entry>> macaddr_mapping;
    std::vector<asio::ip::address_v4> gateway;
    std::vector<asio::ip::address_v6> dns6_servers;
    std::vector<asio::ip::address_v4> dns4_servers;
    std::vector<asio::ip::address_v6> ntp6_servers;
    std::vector<asio::ip::address_v4> ntp4_servers;
    std::vector<asio::ip::address_v6> ntp6_multicasts;
    std::vector<std::string> dns_search;
    std::vector<std::string> ntp6_fqdns;
    asio::ip::address_v4 subnet;
    asio::ip::address_v4 broadcast;
    std::vector<uint8_t> dns_search_blob;
    std::vector<uint8_t> ntp6_fqdns_blob;
    std::pair<asio::ip::address_v4, asio::ip::address_v4> dynamic_range;
    uint32_t dynamic_lifetime;
    uint8_t preference;
    bool use_dhcpv4:1;
    bool use_dhcpv6:1;
    bool use_dynamic_v4:1;
    bool use_dynamic_v6:1;
};

static std::unordered_map<std::string, interface_data> interface_state;

// Performs DNS label wire encoding cf RFC1035 3.1
// Allocates memory frequently in order to make correctness easier to
// verify, but at least in this program, it will called only at
// reconfiguration.
static std::vector<uint8_t> dns_label(const std::string &ds)
{
{'fraction_non_alphanumeric': 0.12919410473502665, 'fraction_numerical': 0.02947632486672938, 'mean_word_length': 5.980306345733042, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6561034', 'n_tokens_mistral': 1241, 'n_tokens_neox': 1212, 'n_words': 211}