netdb.h revision 0c27b3fe77ac1d5094ba3521e8142d9e7973133f
/*
* Copyright (C) 2000, 2001, 2004, 2006, 2007, 2009, 2013, 2016 Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/* $Id: netdb.h,v 1.9 2009/01/18 23:48:14 tbox Exp $ */
#ifndef NETDB_H
#define NETDB_H 1
#include <stddef.h>
#include <winsock2.h>
/*
* Define if <netdb.h> does not declare struct addrinfo.
*/
#if _MSC_VER < 1600
struct addrinfo {
int ai_flags; /* AI_PASSIVE, AI_CANONNAME */
int ai_family; /* PF_xxx */
int ai_socktype; /* SOCK_xxx */
int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */
char *ai_canonname; /* Canonical name for hostname */
};
#endif
/*
* Undefine all \#defines we are interested in as <netdb.h> may or may not have
* defined them.
*/
/*
* Error return codes from gethostbyname() and gethostbyaddr()
* (left in extern int h_errno).
*/
#define NETDB_SUCCESS 0 /* no problem */
/*
* Error return codes from getaddrinfo()
*/
#define EAI_BADHINTS 12
#define EAI_PROTOCOL 13
#define EAI_MAX 14
/*
* Flag values for getaddrinfo()
*/
#define AI_PASSIVE 0x00000001
#define AI_CANONNAME 0x00000002
#define AI_NUMERICHOST 0x00000004
/*
* Flag values for getipnodebyname()
*/
#define AI_V4MAPPED 0x00000008
#define AI_ALL 0x00000010
#define AI_ADDRCONFIG 0x00000020
/*
* Constants for getnameinfo()
*/
#define NI_MAXHOST 1025
#define NI_MAXSERV 32
/*
* Flag values for getnameinfo()
*/
#define NI_NOFQDN 0x00000001
#define NI_NUMERICHOST 0x00000002
#define NI_NAMEREQD 0x00000004
#define NI_NUMERICSERV 0x00000008
#define NI_DGRAM 0x00000010
/*
* Structures for getrrsetbyname()
*/
struct rdatainfo {
unsigned int rdi_length;
unsigned char *rdi_data;
};
struct rrsetinfo {
unsigned int rri_flags;
int rri_rdclass;
int rri_rdtype;
unsigned int rri_ttl;
unsigned int rri_nrdatas;
unsigned int rri_nsigs;
char *rri_name;
struct rdatainfo *rri_rdatas;
};
/*
* Flags for getrrsetbyname()
*/
#define RRSET_VALIDATED 0x00000001
/* Set was dnssec validated */
/*
* Return codes for getrrsetbyname()
*/
#define ERRSET_SUCCESS 0
#define ERRSET_NOMEMORY 1
#define ERRSET_FAIL 2
#define ERRSET_INVAL 3
#endif /* NETDB_H */