netdb.h revision f42c0dcca86f2009c089e27ba513cb6fc9ee88ba
/*
* Copyright (C) 2004, 2006, 2007, 2009 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2000, 2001 Internet Software Consortium.
*
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $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 */