Zig 0.17.0-dev (Split by item)

This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig library itself.

DNS

windows.DNS
pub const DNS = struct

File

lib/std/os/windows.zig:1486

Code

pub const DNS = struct {
    pub const INTERFACE_SETTINGS = extern struct {
        Version: ULONG,
        Flags: ULONG64,
        Domain: PWSTR,
        NameServer: PWSTR,
        SearchList: PWSTR,
        RegistrationEnabled: ULONG,
        RegisterAdapterName: ULONG,
        EnableLLMNR: ULONG,
        QueryAdapterName: ULONG,
        ProfileNameServer: PWSTR,
    };

    // ref: shared/windnsdef.h

    pub const ADDR_MAX_SOCKADDR_LENGTH = 32;

    pub const ADDR = extern struct {
        MaxSa: [ADDR_MAX_SOCKADDR_LENGTH]CHAR,
        DnsAddrUserDword: [8]DWORD,

        pub const ARRAY = extern struct {
            MaxCount: DWORD,
            AddrCount: DWORD,
            Tag: DWORD,
            Family: WORD,
            WordReserved: WORD,
            Flags: DWORD,
            MatchFlag: DWORD,
            Reserved1: DWORD,
            Reserved2: DWORD,
            AddrArray: [0]ADDR,
        };
    };

    pub const CUSTOM_SERVER = extern struct {
        ServerType: CUSTOM_SERVER.TYPE,
        Flags: FLAGS,
        Info: extern union {
            UDP: void,
            DOH: extern struct { Template: PWSTR },
            DOT: extern struct { Hostname: PWSTR },
        },
        MaxSa: [ADDR_MAX_SOCKADDR_LENGTH]CHAR,

        pub const TYPE = enum(DWORD) { UDP = 0x1, DOH = 0x2, DOT = 0x3, _ };
        pub const FLAGS = packed struct(ULONG64) {
            UDP_FALLBACK: bool = false,
            UPGRADE_FROM_WELL_KNOWN_SERVERS: bool = false,
            Reserved2: u62 = 0,
        };
    };

    // ref: um/WinDNS.h

    pub const STATUS = Win32Error;

    pub const TYPE = enum(WORD) {
        A = 0x0001,
        NS = 0x0002,
        MD = 0x0003,
        MF = 0x0004,
        CNAME = 0x0005,
        SOA = 0x0006,
        MB = 0x0007,
        MG = 0x0008,
        MR = 0x0009,
        NULL = 0x000a,
        WKS = 0x000b,
        PTR = 0x000c,
        HINFO = 0x000d,
        MINFO = 0x000e,
        MX = 0x000f,
        TEXT = 0x0010,
        RP = 0x0011,
        AFSDB = 0x0012,
        X25 = 0x0013,
        ISDN = 0x0014,
        RT = 0x0015,
        NSAP = 0x0016,
        NSAPPTR = 0x0017,
        SIG = 0x0018,
        KEY = 0x0019,
        PX = 0x001a,
        GPOS = 0x001b,
        AAAA = 0x001c,
        LOC = 0x001d,
        NXT = 0x001e,
        EID = 0x001f,
        NIMLOC = 0x0020,
        SRV = 0x0021,
        ATMA = 0x0022,
        NAPTR = 0x0023,
        KX = 0x0024,
        CERT = 0x0025,
        A6 = 0x0026,
        DNAME = 0x0027,
        SINK = 0x0028,
        OPT = 0x0029,
        DS = 0x002B,
        RRSIG = 0x002E,
        NSEC = 0x002F,
        DNSKEY = 0x0030,
        DHCID = 0x0031,
        UINFO = 0x0064,
        UID = 0x0065,
        GID = 0x0066,
        UNSPEC = 0x0067,
        ADDRS = 0x00f8,
        TKEY = 0x00f9,
        TSIG = 0x00fa,
        IXFR = 0x00fb,
        AXFR = 0x00fc,
        MAILB = 0x00fd,
        MAILA = 0x00fe,
        ALL = 0x00ff,
        WINS = 0xff01,
        WINSR = 0xff02,
        TLSA = 0x0034,
        SVCB = 0x0040,
        HTTPS = 0x0041,
        pub const NBSTAT: TYPE = .WINSR;
        pub const ANY: TYPE = .ALL;
    };

    pub const QUERY = packed struct(ULONG64) {
        pub const STANDARD: QUERY = .{};
        ACCEPT_TRUNCATED_RESPONSE: bool = false,
        USE_TCP_ONLY: bool = false,
        NO_RECURSION: bool = false,
        BYPASS_CACHE: bool = false,
        NO_WIRE_QUERY: bool = false,
        NO_LOCAL_NAME: bool = false,
        NO_HOSTS_FILE: bool = false,
        NO_NETBT: bool = false,
        WIRE_ONLY: bool = false,
        RETURN_MESSAGE: bool = false,
        MULTICAST_ONLY: bool = false,
        NO_MULTICAST: bool = false,
        TREAT_AS_FQDN: bool = false,
        ADDRCONFIG: bool = false,
        DUAL_ADDR: bool = false,
        Reserved15: u2 = 0,
        MULTICAST_WAIT: bool = false,
        MULTICAST_VERIFY: bool = false,
        Reserved19: u1 = 0,
        DONT_RESET_TTL_VALUES: bool = false,
        DISABLE_IDN_ENCODING: bool = false,
        Reserved22: u1 = 0,
        APPEND_MULTILABEL: bool = false,
        Reserved24: u34 = 0,
        PARSE_ALL_RECORDS: bool = false,
        Reserved59: u5 = 0,

        pub const REQUEST = extern struct {
            Version: DWORD,
            QueryName: PCWSTR,
            QueryType: TYPE,
            QueryOptions: QUERY = .STANDARD,
            pDnsServerList: ?*ADDR.ARRAY = null,
            InterfaceIndex: ULONG = 0,
            pQueryCompletionCallback: ?*const COMPLETION_ROUTINE = null,
            pQueryContext: ?*anyopaque = null,

            pub const @"3" = extern struct {
                Base: REQUEST,
                IsNetworkQueryRequired: BOOL = .FALSE,
                RequiredNetworkIndex: DWORD = 0,
                cCustomServers: DWORD = 0,
                pCustomServers: ?*CUSTOM_SERVER = null,
            };
        };
        pub const RESULT = extern struct {
            Version: ULONG,
            QueryStatus: STATUS,
            QueryOptions: QUERY,
            pQueryRecords: ?*RECORD,
            Reserved: ?*anyopaque,
        };
        pub const CANCEL = extern struct {
            Reserved: [32]CHAR align(8),
        };
        pub const COMPLETION_ROUTINE = fn (
            pQueryContext: ?*anyopaque,
            pQueryResults: *RESULT,
        ) callconv(.winapi) void;
    };
    pub const FREE_TYPE = enum(c_int) { Flat = 0, RecordList, ParsedMessageFields };
    pub const RECORD = extern struct {
        pNext: ?*RECORD,
        pName: *anyopaque,
        wType: TYPE,
        wDataLength: WORD,
        Flags: FLAGS,
        dwTtl: DWORD,
        dwReserved: DWORD,
        Data: extern union { A: [4]u8, AAAA: [16]u8 },

        pub const FLAGS = packed struct(DWORD) {
            Section: SECTION,
            Delete: u1,
            CharSet: u2,
            Unused: u3,
            Reserved: u24,
        };
    };
    pub const SECTION = enum(u2) { Question, Answer, Authority, Additional };
}