Nut/OS  4.10.3
API Reference
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$
00084  * Revision 1.9  2009/03/05 22:16:57  freckle
00085  * use __NUT_EMULATION instead of __APPLE__, __linux__, or __CYGWIN__
00086  *
00087  * Revision 1.8  2008/08/11 06:59:58  haraldkipp
00088  * BSD types replaced by stdint types (feature request #1282721).
00089  *
00090  * Revision 1.7  2008/02/15 17:07:09  haraldkipp
00091  * Added routine to query DNS IP settings.
00092  *
00093  * Revision 1.6  2005/07/26 15:49:59  haraldkipp
00094  * Cygwin support added.
00095  *
00096  * Revision 1.5  2005/04/04 19:33:40  freckle
00097  * added creation of include/netdb_orig.h, include/sys/socket_orig.h and
00098  * include/netinet/in_orig.h to allow unix emulation to use tcp/ip sockets
00099  *
00100  * Revision 1.4  2004/04/15 19:28:02  drsung
00101  * New function NutDnsGetMxByDomain to request
00102  * an MX record from DNS server.
00103  *
00104  * Revision 1.3  2004/03/16 16:48:27  haraldkipp
00105  * Added Jan Dubiec's H8/300 port.
00106  *
00107  * Revision 1.2  2003/07/20 18:26:41  haraldkipp
00108  * Support secondary DNS.
00109  *
00110  * Revision 1.1.1.1  2003/05/09 14:41:03  haraldkipp
00111  * Initial using 3.2.1
00112  *
00113  * Revision 1.5  2003/05/06 18:38:33  harald
00114  * Cleanup
00115  *
00116  * Revision 1.4  2003/02/04 18:00:36  harald
00117  * Version 3 released
00118  *
00119  * Revision 1.3  2002/06/26 17:29:14  harald
00120  * First pre-release with 2.4 stack
00121  *
00122  */
00123 
00124 /* use native version on unix emulation */
00125 #ifdef __NUT_EMULATION__
00126 #include <netdb_orig.h>
00127 /* assure _NETDB_H_ is set */
00128 #undef  _NETDB_H_
00129 #define _NETDB_H_
00130 #else  /* unix emulation */
00131 
00132 #define _NETDB_H_
00133 #include <sys/types.h>
00134 #include <stdint.h>
00135 
00136 #include <compiler.h> // For NUT_DEPRECATED
00137 
00138 __BEGIN_DECLS
00139 
00140 /*
00141  * Error return codes.
00142  */
00143 #define NETDB_INTERNAL  -1      /* see errno */
00144 #define NETDB_SUCCESS   0       /* no problem */
00145 #define HOST_NOT_FOUND  1       /* Authoritative Answer Host not found */
00146 #define TRY_AGAIN       2       /* Non-Authoritative Host not found, or SERVERFAIL */
00147 #define NO_RECOVERY     3       /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
00148 #define NO_DATA         4       /* Valid name, no data record of requested type */
00149 #define NO_ADDRESS      NO_DATA /* no address, look for MX record */
00150 
00151 __END_DECLS
00152 
00153 #endif /* unix emulation */
00154 
00155 typedef struct {
00156     uint8_t *doc_hostname;
00157     uint8_t *doc_domain;
00158     uint32_t doc_ip1;
00159     uint32_t doc_ip2;
00160 } DNSCONFIG;
00161 
00162 __BEGIN_DECLS
00163 
00164 extern void NutDnsConfig2(CONST uint8_t * hostname, CONST uint8_t * domain, uint32_t pdnsip, uint32_t sdnsip);
00165 extern void NutDnsGetConfig2(char ** hostname, char ** domain, uint32_t *pdnsip, uint32_t *sdnsip);
00166 extern void NutDnsConfig(CONST uint8_t *hostname, CONST uint8_t *domain, uint32_t dnsip) NUT_DEPRECATED;
00167 extern uint32_t NutDnsGetHostByName(CONST uint8_t *hostname);
00168 extern uint8_t NutDnsGetHostsByName(CONST uint8_t * hostname, uint32_t * ip_all);
00169 extern uint32_t NutDnsGetMxByDomain(CONST uint8_t * hostname);
00170 
00171 __END_DECLS
00172 
00173 #endif