Move back resolv.h, nameser.h and netdb.h as they conflict with NetBSD headers and libc.
This commit is contained in:
@@ -16,6 +16,7 @@ INCS+= minix/a.out.h minix/cdrom.h minix/compiler-ack.h minix/dirent.h \
|
||||
minix/dl_eth.h minix/md5.h minix/sha1.h minix/sha2.h minix/types.h
|
||||
|
||||
INCS+= net/hton.h net/if.h net/ioctl.h net/netlib.h
|
||||
INCS+= net/gen/netdb.h net/gen/resolv.h net/gen/nameser.h
|
||||
INCS+= netinet/if_ether.h netinet/in.h netinet/tcp.h
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
125
include/net/gen/nameser.h
Normal file
125
include/net/gen/nameser.h
Normal file
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
* Copyright (c) 1983, 1989 Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
* provided that: (1) source distributions retain this entire copyright
|
||||
* notice and comment, and (2) distributions including binaries display
|
||||
* the following acknowledgement: ``This product includes software
|
||||
* developed by the University of California, Berkeley and its contributors''
|
||||
* in the documentation or other materials provided with the distribution
|
||||
* and in all advertising materials mentioning features or use of this
|
||||
* software. Neither the name of the University nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#)nameser.h 5.24 (Berkeley) 6/1/90
|
||||
*/
|
||||
|
||||
/*
|
||||
server/ip/gen/nameser.h
|
||||
|
||||
Created Sept 18, 1991 by Philip Homburg
|
||||
*/
|
||||
|
||||
#ifndef __SERVER__IP__GEN__NAEMSER_H__
|
||||
#define __SERVER__IP__GEN__NAEMSER_H__
|
||||
|
||||
typedef struct dns_hdr
|
||||
{
|
||||
u16_t dh_id;
|
||||
u8_t dh_flag1;
|
||||
u8_t dh_flag2;
|
||||
u16_t dh_qdcount;
|
||||
u16_t dh_ancount;
|
||||
u16_t dh_nscount;
|
||||
u16_t dh_arcount;
|
||||
} dns_hdr_t;
|
||||
|
||||
typedef dns_hdr_t HEADER;
|
||||
|
||||
#define DHF_QR 0x80
|
||||
#define DHF_OPCODE 0x78
|
||||
#define DHF_AA 0x04
|
||||
#define DHF_TC 0x02
|
||||
#define DHF_RD 0x01
|
||||
|
||||
#define DHF_RA 0x80
|
||||
#define DHF_PR 0x40
|
||||
#define DHF_UNUSED 0x30
|
||||
#define DHF_RCODE 0x0F
|
||||
|
||||
/*
|
||||
Define constants based on rfc883
|
||||
*/
|
||||
#define PACKETSZ 512 /* maximum packet size */
|
||||
#define MAXDNAME 256 /* maximum domain name */
|
||||
#define MAXCDNAME 255 /* maximum compressed domain name */
|
||||
#define MAXLABEL 63 /* maximum length of domain label */
|
||||
/* Number of bytes of fixed size data in query structure */
|
||||
#define QFIXEDSZ 4
|
||||
/* number of bytes of fixed size data in resource record */
|
||||
#define RRFIXEDSZ 10
|
||||
#define INDIR_MASK 0xc0
|
||||
/* Defines for handling compressed domain names */
|
||||
|
||||
/*
|
||||
Opcodes for DNS
|
||||
*/
|
||||
|
||||
#define QUERY 0x0 /* standard query */
|
||||
#define IQUERY 0x1 /* inverse query */
|
||||
|
||||
/*
|
||||
Error codes
|
||||
*/
|
||||
#define NOERROR 0 /* no error */
|
||||
#define FORMERR 1 /* format error */
|
||||
#define SERVFAIL 2 /* server failure */
|
||||
#define NXDOMAIN 3 /* non existent domain */
|
||||
#define NOTIMP 4 /* not implemented */
|
||||
#define REFUSED 5 /* query refused */
|
||||
/* non standard */
|
||||
#define NOCHANGE 0xf /* update failed to change db */
|
||||
|
||||
/* Valid types */
|
||||
|
||||
#define T_A 1 /* host address */
|
||||
#define T_NS 2 /* authoritative server */
|
||||
#define T_MD 3 /* mail destination */
|
||||
#define T_MF 4 /* mail forwarder */
|
||||
#define T_CNAME 5 /* connonical name */
|
||||
#define T_SOA 6 /* start of authority zone */
|
||||
#define T_MB 7 /* mailbox domain name */
|
||||
#define T_MG 8 /* mail group member */
|
||||
#define T_MR 9 /* mail rename name */
|
||||
#define T_NULL 10 /* null resource record */
|
||||
#define T_WKS 11 /* well known service */
|
||||
#define T_PTR 12 /* domain name pointer */
|
||||
#define T_HINFO 13 /* host information */
|
||||
#define T_MINFO 14 /* mailbox information */
|
||||
#define T_MX 15 /* mail routing information */
|
||||
#define T_TXT 16 /* text strings */
|
||||
/* non standard */
|
||||
#define T_UINFO 100 /* user (finger) information */
|
||||
#define T_UID 101 /* user ID */
|
||||
#define T_GID 102 /* group ID */
|
||||
#define T_UNSPEC 103 /* Unspecified format (binary data) */
|
||||
/* Query type values which do not appear in resource records */
|
||||
#define T_AXFR 252 /* transfer zone of authority */
|
||||
#define T_MAILB 253 /* transfer mailbox records */
|
||||
#define T_MAILA 254 /* transfer mail agent records */
|
||||
#define T_ANY 255 /* wildcard match */
|
||||
|
||||
/* Valid classes */
|
||||
|
||||
#define C_IN 1 /* the internet */
|
||||
#define C_CHAOS 3 /* for chaos net (MIT) */
|
||||
#define C_HS 4 /* for Hesiod name server at MIT */
|
||||
|
||||
#define C_ANY 255 /* wildcard */
|
||||
|
||||
#endif /* __SERVER__IP__GEN__NAEMSER_H__ */
|
||||
198
include/net/gen/netdb.h
Normal file
198
include/net/gen/netdb.h
Normal file
@@ -0,0 +1,198 @@
|
||||
/*-
|
||||
* Copyright (c) 1980, 1983, 1988 Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)netdb.h 5.15 (Berkeley) 4/3/91
|
||||
*/
|
||||
|
||||
#ifndef _NETDB_H_
|
||||
#define _NETDB_H_
|
||||
|
||||
#define _PATH_HEQUIV "/etc/hosts.equiv"
|
||||
#define _PATH_HOSTS "/etc/hosts"
|
||||
#define _PATH_NETWORKS "/etc/networks"
|
||||
#define _PATH_PROTOCOLS "/etc/protocols"
|
||||
#define _PATH_SERVICES "/etc/services"
|
||||
#define _PATH_SERVACCES "/etc/serv.access"
|
||||
|
||||
/*
|
||||
* Structures returned by network data base library. All addresses are
|
||||
* supplied in host order, and returned in network order (suitable for
|
||||
* use in system calls).
|
||||
*/
|
||||
struct hostent {
|
||||
char *h_name; /* official name of host */
|
||||
char **h_aliases; /* alias list */
|
||||
int h_addrtype; /* host address type */
|
||||
int h_length; /* length of address */
|
||||
char **h_addr_list; /* list of addresses from name server */
|
||||
#define h_addr h_addr_list[0] /* address, for backward compatiblity */
|
||||
};
|
||||
|
||||
/*
|
||||
* Assumption here is that a network number
|
||||
* fits in 32 bits -- probably a poor one.
|
||||
*/
|
||||
struct netent {
|
||||
char *n_name; /* official name of net */
|
||||
char **n_aliases; /* alias list */
|
||||
int n_addrtype; /* net address type */
|
||||
unsigned long n_net; /* network # */
|
||||
};
|
||||
|
||||
struct servent {
|
||||
char *s_name; /* official service name */
|
||||
char **s_aliases; /* alias list */
|
||||
int s_port; /* port # */
|
||||
char *s_proto; /* protocol to use */
|
||||
};
|
||||
|
||||
struct protoent {
|
||||
char *p_name; /* official protocol name */
|
||||
char **p_aliases; /* alias list */
|
||||
int p_proto; /* protocol # */
|
||||
};
|
||||
|
||||
/*
|
||||
* Error return codes from gethostbyname() and gethostbyaddr()
|
||||
* (left in extern int h_errno).
|
||||
*/
|
||||
extern int h_errno;
|
||||
|
||||
#define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */
|
||||
#define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */
|
||||
#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
|
||||
#define NO_DATA 4 /* Valid name, no data record of requested type */
|
||||
#define NO_ADDRESS NO_DATA /* no address, look for MX record */
|
||||
|
||||
#ifndef _MINIX_ANSI_H
|
||||
#include <minix/ansi.h>
|
||||
#endif
|
||||
|
||||
void endhostent _ARGS((void));
|
||||
void endnetent _ARGS((void));
|
||||
void endprotoent _ARGS((void));
|
||||
void endservent _ARGS((void));
|
||||
struct hostent *gethostbyaddr _ARGS((const char *, int, int));
|
||||
struct hostent *gethostbyname _ARGS((const char *));
|
||||
struct hostent *gethostent _ARGS((void));
|
||||
struct netent *getnetbyaddr _ARGS((long, int)); /* u_long? */
|
||||
struct netent *getnetbyname _ARGS((const char *));
|
||||
struct netent *getnetent _ARGS((void));
|
||||
struct protoent *getprotobyname _ARGS((const char *));
|
||||
struct protoent *getprotobynumber _ARGS((int));
|
||||
struct protoent *getprotoent _ARGS((void));
|
||||
struct servent *getservbyname _ARGS((const char *, const char *));
|
||||
struct servent *getservbyport _ARGS((int, const char *));
|
||||
struct servent *getservent _ARGS((void));
|
||||
void herror _ARGS((const char *));
|
||||
void sethostent _ARGS((int));
|
||||
/* void sethostfile _ARGS((const char *)); */
|
||||
void setnetent _ARGS((int));
|
||||
void setprotoent _ARGS((int));
|
||||
void setservent _ARGS((int));
|
||||
#ifdef _MINIX
|
||||
int servxcheck _ARGS((unsigned long _peer, const char *_service,
|
||||
void (*_logf) _ARGS((int _pass, const char *_name))));
|
||||
char *servxfile _ARGS((const char *_file));
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The definitions below are based on
|
||||
* http://www.opengroup.org/onlinepubs/009695399/basedefs/netdb.h.html
|
||||
*/
|
||||
|
||||
#ifdef _POSIX_SOURCE
|
||||
|
||||
/* headers exposed by netdb.h */
|
||||
#include <inttypes.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
/* struct for use with getaddrinfo() */
|
||||
struct addrinfo
|
||||
{
|
||||
int ai_flags; /* Input flags */
|
||||
int ai_family; /* Address family of socket */
|
||||
int ai_socktype; /* Socket type */
|
||||
int ai_protocol; /* Protocol of socket */
|
||||
socklen_t ai_addrlen; /* Length of socket address */
|
||||
struct sockaddr *ai_addr; /* Socket address of socket */
|
||||
char *ai_canonname; /* Canonical name of service location */
|
||||
struct addrinfo *ai_next; /* Pointer to next in list */
|
||||
};
|
||||
|
||||
/* values for struct addrinfo.ai_flags */
|
||||
#define AI_PASSIVE 0x00000001
|
||||
#define AI_CANONNAME 0x00000002
|
||||
#define AI_NUMERICHOST 0x00000004
|
||||
#define AI_NUMERICSERV 0x00000008
|
||||
/*
|
||||
#define AI_V4MAPPED 0x00000010
|
||||
#define AI_ALL 0x00000020
|
||||
#define AI_ADDRCONFIG 0x00000040
|
||||
*/
|
||||
|
||||
/* flags for getnameinfo() */
|
||||
/* #define NI_NOFQDN 0x00000001 */
|
||||
#define NI_NUMERICHOST 0x00000002
|
||||
#define NI_NAMEREQD 0x00000004
|
||||
#define NI_NUMERICSERV 0x00000008
|
||||
/* #define NI_NUMERICSCOPE 0x00000010 */
|
||||
#define NI_DGRAM 0x00000020
|
||||
|
||||
/* error values for getaddrinfo() and getnameinfo() */
|
||||
#define EAI_AGAIN 1
|
||||
#define EAI_BADFLAGS 2
|
||||
#define EAI_FAIL 3
|
||||
#define EAI_FAMILY 4
|
||||
#define EAI_MEMORY 5
|
||||
#define EAI_NONAME 6
|
||||
#define EAI_SERVICE 7
|
||||
#define EAI_SOCKTYPE 8
|
||||
#define EAI_SYSTEM 9
|
||||
#define EAI_OVERFLOW 10
|
||||
|
||||
/* getaddrinfo() and friends */
|
||||
void freeaddrinfo(struct addrinfo *ai);
|
||||
int getaddrinfo(const char *nodename,
|
||||
const char *servname,
|
||||
const struct addrinfo *hints,
|
||||
struct addrinfo **res);
|
||||
int getnameinfo(const struct sockaddr *sa, socklen_t salen,
|
||||
char *node, socklen_t nodelen, char *service,
|
||||
socklen_t servicelen, int flags);
|
||||
const char *gai_strerror(int ecode);
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* !_NETDB_H_ */
|
||||
|
||||
107
include/net/gen/resolv.h
Normal file
107
include/net/gen/resolv.h
Normal file
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* Copyright (c) 1983, 1987, 1989 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
* provided that: (1) source distributions retain this entire copyright
|
||||
* notice and comment, and (2) distributions including binaries display
|
||||
* the following acknowledgement: ``This product includes software
|
||||
* developed by the University of California, Berkeley and its contributors''
|
||||
* in the documentation or other materials provided with the distribution
|
||||
* and in all advertising materials mentioning features or use of this
|
||||
* software. Neither the name of the University nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#)resolv.h 5.10 (Berkeley) 6/1/90
|
||||
*/
|
||||
#ifndef _NET__GEN__RESOLV_H
|
||||
#define _NET__GEN__RESOLV_H
|
||||
|
||||
/*
|
||||
* Resolver configuration file.
|
||||
* Normally not present, but may contain the address of the
|
||||
* inital name server(s) to query and the domain search list.
|
||||
*/
|
||||
|
||||
#ifndef _PATH_RESCONF
|
||||
#define _PATH_RESCONF "/etc/resolv.conf"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Global defines and variables for resolver stub.
|
||||
*/
|
||||
#define MAXNS 3 /* max # name servers we'll track */
|
||||
#define MAXDFLSRCH 3 /* # default domain levels to try */
|
||||
#define MAXDNSRCH 6 /* max # domains in search path */
|
||||
#define LOCALDOMAINPARTS 2 /* min levels in name that is "local" */
|
||||
|
||||
#define RES_TIMEOUT 5 /* min. seconds between retries */
|
||||
|
||||
#define NAMESERVER_PORT 53
|
||||
|
||||
struct state {
|
||||
int retrans; /* retransmition time interval */
|
||||
int retry; /* number of times to retransmit */
|
||||
long options; /* option flags - see below. */
|
||||
int nscount; /* number of name servers */
|
||||
ipaddr_t nsaddr_list[MAXNS]; /* address of name server */
|
||||
#define nsaddr nsaddr_list[0] /* for backward compatibility */
|
||||
u16_t nsport_list[MAXNS]; /* port of name server */
|
||||
u16_t id; /* current packet id */
|
||||
char defdname[MAXDNAME]; /* default domain */
|
||||
char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */
|
||||
};
|
||||
|
||||
/*
|
||||
* Resolver options
|
||||
*/
|
||||
#define RES_INIT 0x0001 /* address initialized */
|
||||
#define RES_DEBUG 0x0002 /* print debug messages */
|
||||
#define RES_AAONLY 0x0004 /* authoritative answers only */
|
||||
#define RES_USEVC 0x0008 /* use virtual circuit */
|
||||
#define RES_PRIMARY 0x0010 /* query primary server only */
|
||||
#define RES_IGNTC 0x0020 /* ignore trucation errors */
|
||||
#define RES_RECURSE 0x0040 /* recursion desired */
|
||||
#define RES_DEFNAMES 0x0080 /* use default domain name */
|
||||
#define RES_STAYOPEN 0x0100 /* Keep TCP socket open */
|
||||
#define RES_DNSRCH 0x0200 /* search up local domain tree */
|
||||
|
||||
#define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH )
|
||||
|
||||
extern struct state _res;
|
||||
|
||||
struct rrec;
|
||||
|
||||
int res_init _ARGS(( void ));
|
||||
int res_mkquery _ARGS(( int op, const char *dname, int cls, int type,
|
||||
const char *data, int datalen, const struct rrec *newrr,
|
||||
char *buf, int buflen ));
|
||||
int res_query _ARGS(( char *name, int cls, int type, u8_t *answer,
|
||||
int anslen ));
|
||||
int res_querydomain _ARGS(( char *name, char *domain, int cls, int type,
|
||||
u8_t *answer, int anslen ));
|
||||
int res_search _ARGS(( char *name, int cls, int type, u8_t *answer,
|
||||
int anslen ));
|
||||
int res_send _ARGS(( const char *buf, int buflen, char *answer, int anslen ));
|
||||
void _res_close _ARGS(( void ));
|
||||
|
||||
int dn_comp _ARGS(( const u8_t *exp_dn, u8_t *comp_dn, int length,
|
||||
u8_t **dnptrs, u8_t **lastdnptr ));
|
||||
int dn_expand _ARGS(( const u8_t *msg, const u8_t *eomorig,
|
||||
const u8_t *comp_dn, u8_t *exp_dn, int length ));
|
||||
int dn_skipname _ARGS(( const u8_t *comp_dn, const u8_t *eom ));
|
||||
|
||||
char *__hostalias _ARGS(( const char *name ));
|
||||
|
||||
u16_t _getshort _ARGS(( const u8_t *msgp ));
|
||||
u32_t _getlong _ARGS(( const u8_t *msgp ));
|
||||
void __putshort _ARGS(( u16_t s, u8_t *msgp ));
|
||||
void __putlong _ARGS(( u32_t l, u8_t *msgp ));
|
||||
|
||||
void p_query _ARGS(( char *msg ));
|
||||
|
||||
#endif /* _NET__GEN__RESOLV_H */
|
||||
Reference in New Issue
Block a user