|
Packit Service |
ae04f2 |
/*
|
|
Packit Service |
ae04f2 |
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
|
Packit Service |
ae04f2 |
*
|
|
Packit Service |
ae04f2 |
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
Packit Service |
ae04f2 |
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
Packit Service |
ae04f2 |
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
Packit Service |
ae04f2 |
*
|
|
Packit Service |
ae04f2 |
* See the COPYRIGHT file distributed with this work for additional
|
|
Packit Service |
ae04f2 |
* information regarding copyright ownership.
|
|
Packit Service |
ae04f2 |
*/
|
|
Packit Service |
ae04f2 |
|
|
Packit Service |
ae04f2 |
|
|
Packit Service |
ae04f2 |
#ifndef NETDB_H
|
|
Packit Service |
ae04f2 |
#define NETDB_H 1
|
|
Packit Service |
ae04f2 |
|
|
Packit Service |
ae04f2 |
#include <stddef.h>
|
|
Packit Service |
ae04f2 |
#include <winsock2.h>
|
|
Packit Service |
ae04f2 |
|
|
Packit Service |
ae04f2 |
/*
|
|
Packit Service |
ae04f2 |
* Define if <netdb.h> does not declare struct addrinfo.
|
|
Packit Service |
ae04f2 |
*/
|
|
Packit Service |
ae04f2 |
|
|
Packit Service |
ae04f2 |
#if _MSC_VER < 1600
|
|
Packit Service |
ae04f2 |
struct addrinfo {
|
|
Packit Service |
ae04f2 |
int ai_flags; /* AI_PASSIVE, AI_CANONNAME */
|
|
Packit Service |
ae04f2 |
int ai_family; /* PF_xxx */
|
|
Packit Service |
ae04f2 |
int ai_socktype; /* SOCK_xxx */
|
|
Packit Service |
ae04f2 |
int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */
|
|
Packit Service |
ae04f2 |
size_t ai_addrlen; /* Length of ai_addr */
|
|
Packit Service |
ae04f2 |
char *ai_canonname; /* Canonical name for hostname */
|
|
Packit Service |
ae04f2 |
struct sockaddr *ai_addr; /* Binary address */
|
|
Packit Service |
ae04f2 |
struct addrinfo *ai_next; /* Next structure in linked list */
|
|
Packit Service |
ae04f2 |
};
|
|
Packit Service |
ae04f2 |
#endif
|
|
Packit Service |
ae04f2 |
|
|
Packit Service |
ae04f2 |
|
|
Packit Service |
ae04f2 |
/*
|
|
Packit Service |
ae04f2 |
* Undefine all \#defines we are interested in as <netdb.h> may or may not have
|
|
Packit Service |
ae04f2 |
* defined them.
|
|
Packit Service |
ae04f2 |
*/
|
|
Packit Service |
ae04f2 |
|
|
Packit Service |
ae04f2 |
/*
|
|
Packit Service |
ae04f2 |
* Error return codes from gethostbyname() and gethostbyaddr()
|
|
Packit Service |
ae04f2 |
* (left in extern int h_errno).
|
|
Packit Service |
ae04f2 |
*/
|
|
Packit Service |
ae04f2 |
|
|
Packit Service |
ae04f2 |
#undef NETDB_INTERNAL
|
|
Packit Service |
ae04f2 |
#undef NETDB_SUCCESS
|
|
Packit Service |
ae04f2 |
#undef HOST_NOT_FOUND
|
|
Packit Service |
ae04f2 |
#undef TRY_AGAIN
|
|
Packit Service |
ae04f2 |
#undef NO_RECOVERY
|
|
Packit Service |
ae04f2 |
#undef NO_DATA
|
|
Packit Service |
ae04f2 |
#undef NO_ADDRESS
|
|
Packit Service |
ae04f2 |
|
|
Packit Service |
ae04f2 |
#define NETDB_INTERNAL -1 /* see errno */
|
|
Packit Service |
ae04f2 |
#define NETDB_SUCCESS 0 /* no problem */
|
|
Packit Service |
ae04f2 |
#define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */
|
|
Packit Service |
ae04f2 |
#define TRY_AGAIN 2 /* Non-Authoritative Host not found, or SERVERFAIL */
|
|
Packit Service |
ae04f2 |
#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
|
|
Packit Service |
ae04f2 |
#define NO_DATA 4 /* Valid name, no data record of requested type */
|
|
Packit Service |
ae04f2 |
#define NO_ADDRESS NO_DATA /* no address, look for MX record */
|
|
Packit Service |
ae04f2 |
|
|
Packit Service |
ae04f2 |
/*
|
|
Packit Service |
ae04f2 |
* Error return codes from getaddrinfo()
|
|
Packit Service |
ae04f2 |
*/
|
|
Packit Service |
ae04f2 |
|
|
Packit Service |
ae04f2 |
#undef EAI_ADDRFAMILY
|
|
Packit Service |
ae04f2 |
#undef EAI_AGAIN
|
|
Packit Service |
ae04f2 |
#undef EAI_BADFLAGS
|
|
Packit Service |
ae04f2 |
#undef EAI_FAIL
|
|
Packit Service |
ae04f2 |
#undef EAI_FAMILY
|
|
Packit Service |
ae04f2 |
#undef EAI_MEMORY
|
|
Packit Service |
ae04f2 |
#undef EAI_NODATA
|
|
Packit Service |
ae04f2 |
#undef EAI_NONAME
|
|
Packit Service |
ae04f2 |
#undef EAI_SERVICE
|
|
Packit Service |
ae04f2 |
#undef EAI_SOCKTYPE
|
|
Packit Service |
ae04f2 |
#undef EAI_SYSTEM
|
|
Packit Service |
ae04f2 |
#undef EAI_BADHINTS
|
|
Packit Service |
ae04f2 |
#undef EAI_PROTOCOL
|
|
Packit Service |
ae04f2 |
#undef EAI_MAX
|
|
Packit Service |
ae04f2 |
|
|
Packit Service |
ae04f2 |
#define EAI_ADDRFAMILY 1 /* address family for hostname not supported */
|
|
Packit Service |
ae04f2 |
#define EAI_AGAIN 2 /* temporary failure in name resolution */
|
|
Packit Service |
ae04f2 |
#define EAI_BADFLAGS 3 /* invalid value for ai_flags */
|
|
Packit Service |
ae04f2 |
#define EAI_FAIL 4 /* non-recoverable failure in name resolution */
|
|
Packit Service |
ae04f2 |
#define EAI_FAMILY 5 /* ai_family not supported */
|
|
Packit Service |
ae04f2 |
#define EAI_MEMORY 6 /* memory allocation failure */
|
|
Packit Service |
ae04f2 |
#define EAI_NODATA 7 /* no address associated with hostname */
|
|
Packit Service |
ae04f2 |
#define EAI_NONAME 8 /* hostname nor servname provided, or not known */
|
|
Packit Service |
ae04f2 |
#define EAI_SERVICE 9 /* servname not supported for ai_socktype */
|
|
Packit Service |
ae04f2 |
#define EAI_SOCKTYPE 10 /* ai_socktype not supported */
|
|
Packit Service |
ae04f2 |
#define EAI_SYSTEM 11 /* system error returned in errno */
|
|
Packit Service |
ae04f2 |
#define EAI_BADHINTS 12
|
|
Packit Service |
ae04f2 |
#define EAI_PROTOCOL 13
|
|
Packit Service |
ae04f2 |
#define EAI_MAX 14
|
|
Packit Service |
ae04f2 |
|
|
Packit Service |
ae04f2 |
/*
|
|
Packit Service |
ae04f2 |
* Flag values for getaddrinfo()
|
|
Packit Service |
ae04f2 |
*/
|
|
Packit Service |
ae04f2 |
#undef AI_PASSIVE
|
|
Packit Service |
ae04f2 |
#undef AI_CANONNAME
|
|
Packit Service |
ae04f2 |
#undef AI_NUMERICHOST
|
|
Packit Service |
ae04f2 |
|
|
Packit Service |
ae04f2 |
#define AI_PASSIVE 0x00000001
|
|
Packit Service |
ae04f2 |
#define AI_CANONNAME 0x00000002
|
|
Packit Service |
ae04f2 |
#define AI_NUMERICHOST 0x00000004
|
|
Packit Service |
ae04f2 |
|
|
Packit Service |
ae04f2 |
/*
|
|
Packit Service |
ae04f2 |
* Flag values for getipnodebyname()
|
|
Packit Service |
ae04f2 |
*/
|
|
Packit Service |
ae04f2 |
#undef AI_V4MAPPED
|
|
Packit Service |
ae04f2 |
#undef AI_ALL
|
|
Packit Service |
ae04f2 |
#undef AI_ADDRCONFIG
|
|
Packit Service |
ae04f2 |
#undef AI_DEFAULT
|
|
Packit Service |
ae04f2 |
|
|
Packit Service |
ae04f2 |
#define AI_V4MAPPED 0x00000008
|
|
Packit Service |
ae04f2 |
#define AI_ALL 0x00000010
|
|
Packit Service |
ae04f2 |
#define AI_ADDRCONFIG 0x00000020
|
|
Packit Service |
ae04f2 |
#define AI_DEFAULT (AI_V4MAPPED|AI_ADDRCONFIG)
|
|
Packit Service |
ae04f2 |
|
|
Packit Service |
ae04f2 |
/*
|
|
Packit Service |
ae04f2 |
* Constants for getnameinfo()
|
|
Packit Service |
ae04f2 |
*/
|
|
Packit Service |
ae04f2 |
#undef NI_MAXHOST
|
|
Packit Service |
ae04f2 |
#undef NI_MAXSERV
|
|
Packit Service |
ae04f2 |
|
|
Packit Service |
ae04f2 |
#define NI_MAXHOST 1025
|
|
Packit Service |
ae04f2 |
#define NI_MAXSERV 32
|
|
Packit Service |
ae04f2 |
|
|
Packit Service |
ae04f2 |
/*
|
|
Packit Service |
ae04f2 |
* Flag values for getnameinfo()
|
|
Packit Service |
ae04f2 |
*/
|
|
Packit Service |
ae04f2 |
#undef NI_NOFQDN
|
|
Packit Service |
ae04f2 |
#undef NI_NUMERICHOST
|
|
Packit Service |
ae04f2 |
#undef NI_NAMEREQD
|
|
Packit Service |
ae04f2 |
#undef NI_NUMERICSERV
|
|
Packit Service |
ae04f2 |
#undef NI_DGRAM
|
|
Packit Service |
ae04f2 |
#undef NI_NUMERICSCOPE
|
|
Packit Service |
ae04f2 |
|
|
Packit Service |
ae04f2 |
#define NI_NOFQDN 0x00000001
|
|
Packit Service |
ae04f2 |
#define NI_NUMERICHOST 0x00000002
|
|
Packit Service |
ae04f2 |
#define NI_NAMEREQD 0x00000004
|
|
Packit Service |
ae04f2 |
#define NI_NUMERICSERV 0x00000008
|
|
Packit Service |
ae04f2 |
#define NI_DGRAM 0x00000010
|
|
Packit Service |
ae04f2 |
#define NI_NUMERICSCOPE 0x00000020 /*2553bis-00*/
|
|
Packit Service |
ae04f2 |
|
|
Packit Service |
ae04f2 |
/*
|
|
Packit Service |
ae04f2 |
* Structures for getrrsetbyname()
|
|
Packit Service |
ae04f2 |
*/
|
|
Packit Service |
ae04f2 |
struct rdatainfo {
|
|
Packit Service |
ae04f2 |
unsigned int rdi_length;
|
|
Packit Service |
ae04f2 |
unsigned char *rdi_data;
|
|
Packit Service |
ae04f2 |
};
|
|
Packit Service |
ae04f2 |
|
|
Packit Service |
ae04f2 |
struct rrsetinfo {
|
|
Packit Service |
ae04f2 |
unsigned int rri_flags;
|
|
Packit Service |
ae04f2 |
int rri_rdclass;
|
|
Packit Service |
ae04f2 |
int rri_rdtype;
|
|
Packit Service |
ae04f2 |
unsigned int rri_ttl;
|
|
Packit Service |
ae04f2 |
unsigned int rri_nrdatas;
|
|
Packit Service |
ae04f2 |
unsigned int rri_nsigs;
|
|
Packit Service |
ae04f2 |
char *rri_name;
|
|
Packit Service |
ae04f2 |
struct rdatainfo *rri_rdatas;
|
|
Packit Service |
ae04f2 |
struct rdatainfo *rri_sigs;
|
|
Packit Service |
ae04f2 |
};
|
|
Packit Service |
ae04f2 |
|
|
Packit Service |
ae04f2 |
/*
|
|
Packit Service |
ae04f2 |
* Flags for getrrsetbyname()
|
|
Packit Service |
ae04f2 |
*/
|
|
Packit Service |
ae04f2 |
#define RRSET_VALIDATED 0x00000001
|
|
Packit Service |
ae04f2 |
/* Set was dnssec validated */
|
|
Packit Service |
ae04f2 |
|
|
Packit Service |
ae04f2 |
/*
|
|
Packit Service |
ae04f2 |
* Return codes for getrrsetbyname()
|
|
Packit Service |
ae04f2 |
*/
|
|
Packit Service |
ae04f2 |
#define ERRSET_SUCCESS 0
|
|
Packit Service |
ae04f2 |
#define ERRSET_NOMEMORY 1
|
|
Packit Service |
ae04f2 |
#define ERRSET_FAIL 2
|
|
Packit Service |
ae04f2 |
#define ERRSET_INVAL 3
|
|
Packit Service |
ae04f2 |
|
|
Packit Service |
ae04f2 |
|
|
Packit Service |
ae04f2 |
#endif /* NETDB_H */
|