netdb.h

Go to the documentation of this file.
00001 #ifndef _NETDB_H_
00002 
00003 /*
00004  * Copyright (C) 2002 by egnite Software GmbH. All rights reserved.
00005  *
00006  * Redistribution and use in source and binary forms, with or without
00007  * modification, are permitted provided that the following conditions
00008  * are met:
00009  *
00010  * 1. Redistributions of source code must retain the above copyright
00011  *    notice, this list of conditions and the following disclaimer.
00012  * 2. Redistributions in binary form must reproduce the above copyright
00013  *    notice, this list of conditions and the following disclaimer in the
00014  *    documentation and/or other materials provided with the distribution.
00015  * 3. Neither the name of the copyright holders nor the names of
00016  *    contributors may be used to endorse or promote products derived
00017  *    from this software without specific prior written permission.
00018  *
00019  * THIS SOFTWARE IS PROVIDED BY EGNITE SOFTWARE GMBH AND CONTRIBUTORS
00020  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00021  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00022  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL EGNITE
00023  * SOFTWARE GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00024  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00025  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
00026  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
00027  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00028  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
00029  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00030  * SUCH DAMAGE.
00031  *
00032  * For additional information see http://www.ethernut.de/
00033  *
00034  * -
00035  * Copyright (c) 1980, 1983, 1988, 1993
00036  *  The Regents of the University of California.  All rights reserved.
00037  *
00038  * Redistribution and use in source and binary forms, with or without
00039  * modification, are permitted provided that the following conditions
00040  * are met:
00041  * 1. Redistributions of source code must retain the above copyright
00042  *    notice, this list of conditions and the following disclaimer.
00043  * 2. Redistributions in binary form must reproduce the above copyright
00044  *    notice, this list of conditions and the following disclaimer in the
00045  *    documentation and/or other materials provided with the distribution.
00046  * 3. Neither the name of the University nor the names of its contributors
00047  *    may be used to endorse or promote products derived from this software
00048  *    without specific prior written permission.
00049  *
00050  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
00051  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00052  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00053  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
00054  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00055  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00056  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00057  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00058  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00059  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00060  * SUCH DAMAGE.
00061  *
00062  * -
00063  * Portions Copyright (c) 1993 by Digital Equipment Corporation.
00064  *
00065  * Permission to use, copy, modify, and distribute this software for any
00066  * purpose with or without fee is hereby granted, provided that the above
00067  * copyright notice and this permission notice appear in all copies, and that
00068  * the name of Digital Equipment Corporation not be used in advertising or
00069  * publicity pertaining to distribution of the document or software without
00070  * specific, written prior permission.
00071  *
00072  * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
00073  * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
00074  * OF MERCHANTABILITY AND FITNESS.   IN NO EVENT SHALL DIGITAL EQUIPMENT
00075  * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
00076  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
00077  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
00078  * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
00079  * SOFTWARE.
00080  */
00081 
00082 /*
00083  * $Log: netdb.h,v $
00084  * Revision 1.7  2008/02/15 17:07:09  haraldkipp
00085  * Added routine to query DNS IP settings.
00086  *
00087  * Revision 1.6  2005/07/26 15:49:59  haraldkipp
00088  * Cygwin support added.
00089  *
00090  * Revision 1.5  2005/04/04 19:33:40  freckle
00091  * added creation of include/netdb_orig.h, include/sys/socket_orig.h and
00092  * include/netinet/in_orig.h to allow unix emulation to use tcp/ip sockets
00093  *
00094  * Revision 1.4  2004/04/15 19:28:02  drsung
00095  * New function NutDnsGetMxByDomain to request
00096  * an MX record from DNS server.
00097  *
00098  * Revision 1.3  2004/03/16 16:48:27  haraldkipp
00099  * Added Jan Dubiec's H8/300 port.
00100  *
00101  * Revision 1.2  2003/07/20 18:26:41  haraldkipp
00102  * Support secondary DNS.
00103  *
00104  * Revision 1.1.1.1  2003/05/09 14:41:03  haraldkipp
00105  * Initial using 3.2.1
00106  *
00107  * Revision 1.5  2003/05/06 18:38:33  harald
00108  * Cleanup
00109  *
00110  * Revision 1.4  2003/02/04 18:00:36  harald
00111  * Version 3 released
00112  *
00113  * Revision 1.3  2002/06/26 17:29:14  harald
00114  * First pre-release with 2.4 stack
00115  *
00116  */
00117 
00118 /* use native version on unix emulation */
00119 #if defined(__linux__) || defined(__APPLE__) || defined(__CYGWIN__)
00120 #include <netdb_orig.h>
00121 /* assure _NETDB_H_ is set */
00122 #undef  _NETDB_H_
00123 #define _NETDB_H_
00124 #else  /* unix emulation */
00125 
00126 #define _NETDB_H_
00127 #include <sys/types.h>
00128 
00129 __BEGIN_DECLS
00130 
00131 /*
00132  * Error return codes.
00133  */
00134 #define NETDB_INTERNAL  -1      /* see errno */
00135 #define NETDB_SUCCESS   0       /* no problem */
00136 #define HOST_NOT_FOUND  1       /* Authoritative Answer Host not found */
00137 #define TRY_AGAIN       2       /* Non-Authoritative Host not found, or SERVERFAIL */
00138 #define NO_RECOVERY     3       /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
00139 #define NO_DATA         4       /* Valid name, no data record of requested type */
00140 #define NO_ADDRESS      NO_DATA /* no address, look for MX record */
00141 
00142 __END_DECLS
00143 
00144 #endif /* unix emulation */
00145 
00146 __BEGIN_DECLS
00147 
00148 extern void NutDnsConfig2(u_char * hostname, u_char * domain, u_long pdnsip, u_long sdnsip);
00149 extern void NutDnsGetConfig2(char ** hostname, char ** domain, u_long *pdnsip, u_long *sdnsip);
00150 extern void NutDnsConfig(CONST u_char *hostname, CONST u_char *domain, u_long dnsip);
00151 extern u_long NutDnsGetHostByName(CONST u_char *hostname);
00152 extern u_long NutDnsGetMxByDomain(CONST u_char * hostname);
00153 
00154 __END_DECLS
00155 
00156 #endif

© 2000-2007 by egnite Software GmbH - visit http://www.ethernut.de/