Blame resolv/resolv-internal.h

Packit Service 82fcde
/* libresolv interfaces for internal use across glibc.
Packit Service 82fcde
   Copyright (C) 2016-2018 Free Software Foundation, Inc.
Packit Service 82fcde
   This file is part of the GNU C Library.
Packit Service 82fcde
Packit Service 82fcde
   The GNU C Library is free software; you can redistribute it and/or
Packit Service 82fcde
   modify it under the terms of the GNU Lesser General Public
Packit Service 82fcde
   License as published by the Free Software Foundation; either
Packit Service 82fcde
   version 2.1 of the License, or (at your option) any later version.
Packit Service 82fcde
Packit Service 82fcde
   The GNU C Library is distributed in the hope that it will be useful,
Packit Service 82fcde
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 82fcde
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service 82fcde
   Lesser General Public License for more details.
Packit Service 82fcde
Packit Service 82fcde
   You should have received a copy of the GNU Lesser General Public
Packit Service 82fcde
   License along with the GNU C Library; if not, see
Packit Service 82fcde
   <http://www.gnu.org/licenses/>.  */
Packit Service 82fcde
Packit Service 82fcde
#ifndef _RESOLV_INTERNAL_H
Packit Service 82fcde
#define _RESOLV_INTERNAL_H 1
Packit Service 82fcde
Packit Service 82fcde
#include <resolv.h>
Packit Service 82fcde
#include <stdbool.h>
Packit Service 82fcde
Packit Service 82fcde
/* Resolver flags.  Used for _flags in struct __res_state.  */
Packit Service 82fcde
#define RES_F_VC        0x00000001 /* Socket is TCP.  */
Packit Service 82fcde
#define RES_F_CONN      0x00000002 /* Socket is connected.  */
Packit Service 82fcde
#define RES_F_EDNS0ERR  0x00000004 /* EDNS0 caused errors.  */
Packit Service 82fcde
Packit Service 82fcde
Packit Service 82fcde
/* Internal version of RES_USE_INET6 which does not trigger a
Packit Service 82fcde
   deprecation warning.  */
Packit Service 82fcde
#define DEPRECATED_RES_USE_INET6 0x00002000
Packit Service 82fcde
Packit Service 82fcde
static inline bool
Packit Service 82fcde
res_use_inet6 (void)
Packit Service 82fcde
{
Packit Service 82fcde
  return _res.options & DEPRECATED_RES_USE_INET6;
Packit Service 82fcde
}
Packit Service 82fcde
Packit Service 82fcde
enum
Packit Service 82fcde
  {
Packit Service 82fcde
    /* The advertized EDNS buffer size.  The value 1200 is derived
Packit Service 82fcde
       from the IPv6 minimum MTU (1280 bytes) minus some arbitrary
Packit Service 82fcde
       space for tunneling overhead.  If the DNS server does not react
Packit Service 82fcde
       to ICMP Fragmentation Needed But DF Set messages, this should
Packit Service 82fcde
       avoid all UDP fragments on current networks.  Avoiding UDP
Packit Service 82fcde
       fragments is desirable because it prevents fragmentation-based
Packit Service 82fcde
       spoofing attacks because the randomness in a DNS packet is
Packit Service 82fcde
       concentrated in the first fragment (with the headers) and does
Packit Service 82fcde
       not protect subsequent fragments.  */
Packit Service 82fcde
    RESOLV_EDNS_BUFFER_SIZE = 1200,
Packit Service 82fcde
  };
Packit Service 82fcde
Packit Service 82fcde
struct resolv_context;
Packit Service 82fcde
Packit Service 82fcde
/* Internal function for implementing res_nmkquery and res_mkquery.
Packit Service 82fcde
   Also used by __res_context_query.  */
Packit Service 82fcde
int __res_context_mkquery (struct resolv_context *, int op, const char *dname,
Packit Service 82fcde
                           int class, int type, const unsigned char *data,
Packit Service 82fcde
                           unsigned char *buf, int buflen) attribute_hidden;
Packit Service 82fcde
Packit Service 82fcde
/* Main resolver query function for use within glibc.  */
Packit Service 82fcde
int __res_context_search (struct resolv_context *, const char *, int, int,
Packit Service 82fcde
                          unsigned char *, int, unsigned char **,
Packit Service 82fcde
                          unsigned char **, int *, int *, int *);
Packit Service 82fcde
libresolv_hidden_proto (__res_context_search)
Packit Service 82fcde
Packit Service 82fcde
/* Main resolver query function for use within glibc.  */
Packit Service 82fcde
int __res_context_query (struct resolv_context *, const char *, int, int,
Packit Service 82fcde
                         unsigned char *, int, unsigned char **,
Packit Service 82fcde
                         unsigned char **, int *, int *, int *);
Packit Service 82fcde
libresolv_hidden_proto (__res_context_query)
Packit Service 82fcde
Packit Service 82fcde
/* Internal function used to implement the query and search
Packit Service 82fcde
   functions.  */
Packit Service 82fcde
int __res_context_send (struct resolv_context *, const unsigned char *, int,
Packit Service 82fcde
                        const unsigned char *, int, unsigned char *,
Packit Service 82fcde
                        int, unsigned char **, unsigned char **,
Packit Service 82fcde
                        int *, int *, int *) attribute_hidden;
Packit Service 82fcde
Packit Service 82fcde
/* Internal function similar to res_hostalias.  */
Packit Service 82fcde
const char *__res_context_hostalias (struct resolv_context *,
Packit Service 82fcde
                                     const char *, char *, size_t);
Packit Service 82fcde
libresolv_hidden_proto (__res_context_hostalias);
Packit Service 82fcde
Packit Service 82fcde
/* Add an OPT record to a DNS query.  */
Packit Service 82fcde
int __res_nopt (struct resolv_context *, int n0,
Packit Service 82fcde
                unsigned char *buf, int buflen, int anslen) attribute_hidden;
Packit Service 82fcde
Packit Service 82fcde
/* Convert from presentation format (which usually means ASCII
Packit Service 82fcde
   printable) to network format (which is usually some kind of binary
Packit Service 82fcde
   format).  The input is in the range [SRC, SRC + SRCLEN).  The
Packit Service 82fcde
   output is written to DST (which has to be 4 or 16 bytes long,
Packit Service 82fcde
   depending on AF).  Return 0 for invalid input, 1 for success, -1
Packit Service 82fcde
   for an invalid address family.  */
Packit Service 82fcde
int __inet_pton_length (int af, const char *src, size_t srclen, void *);
Packit Service 82fcde
libc_hidden_proto (__inet_pton_length)
Packit Service 82fcde
Packit Service 82fcde
/* Called as part of the thread shutdown sequence.  */
Packit Service 82fcde
void __res_thread_freeres (void) attribute_hidden;
Packit Service 82fcde
Packit Service 82fcde
#endif  /* _RESOLV_INTERNAL_H */