00001 /* clib/include/netdb.h 00002 * 00003 * Definitions and structures for resolver etc. 00004 * 00005 * Copyright 2008 Simtec Electronics 00006 * 00007 * Permission is hereby granted, free of charge, to any person 00008 * obtaining a copy of this software and associated documentation 00009 * files (the "Software"), to deal in the Software without 00010 * restriction, including without limitation the rights to use, copy, 00011 * modify, merge, publish, distribute, sublicense, and/or sell copies 00012 * of the Software, and to permit persons to whom the Software is 00013 * furnished to do so, subject to the following conditions: 00014 * 00015 * The above copyright notice and this permission notice shall be 00016 * included in all copies or substantial portions of the Software. 00017 * 00018 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00019 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00020 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00021 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 00022 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 00023 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 00024 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 00025 * SOFTWARE. 00026 * 00027 */ 00028 00029 #ifndef _ABLE_CLIB_NETDB_H 00030 #define _ABLE_CLIB_NETDB_H 1 00031 00033 #define NETDB_INTERNAL -1 00034 00035 #define NETDB_SUCCESS 0 00036 00037 #define HOST_NOT_FOUND 1 00038 00039 #define TRY_AGAIN 2 00040 00041 #define NO_RECOVERY 3 00042 00043 #define NO_DATA 4 00044 00045 #define NO_ADDRESS NO_DATA 00046 00048 struct hostent { 00049 char *h_name; 00050 char **h_aliases; 00051 int h_addrtype; 00052 int h_length; 00053 char **h_addr_list; 00054 }; 00055 00056 /* Some programs need this for compatibility. */ 00057 #define h_addr h_addr_list[0] 00058 00060 extern int h_errno; 00061 00068 extern struct hostent *gethostbyname(const char *name); 00069 00078 extern struct hostent *gethostbyaddr(const void *addr, socklen_t len, int type); 00079 00081 extern void herror(const char *s); 00082 00084 extern const char *hstrerror(int err); 00085 00086 /* These are compatibility defines which have no meaning in ABLE. */ 00087 #define sethostent(stayopen) /* Nothing to do */ 00088 #define endhostent() /* Nothing to do */ 00089 00090 #endif /* _ABLE_CLIB_NETDB_H */