]> git.karo-electronics.de Git - karo-tx-redboot.git/blob - packages/net/ns/dns/v2_0/include/dns.h
Initial revision
[karo-tx-redboot.git] / packages / net / ns / dns / v2_0 / include / dns.h
1 #ifndef CYGONCE_NS_DNS_DNS_H
2 #define CYGONCE_NS_DNS_DNS_H
3 //=============================================================================
4 //
5 //      dns.h
6 //
7 //      DNS client code.
8 //
9 //=============================================================================
10 //####ECOSGPLCOPYRIGHTBEGIN####
11 // -------------------------------------------
12 // This file is part of eCos, the Embedded Configurable Operating System.
13 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
14 // Copyright (C) 2003 Andrew Lunn
15 //
16 // eCos is free software; you can redistribute it and/or modify it under
17 // the terms of the GNU General Public License as published by the Free
18 // Software Foundation; either version 2 or (at your option) any later version.
19 //
20 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY
21 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
22 // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
23 // for more details.
24 //
25 // You should have received a copy of the GNU General Public License along
26 // with eCos; if not, write to the Free Software Foundation, Inc.,
27 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
28 //
29 // As a special exception, if other files instantiate templates or use macros
30 // or inline functions from this file, or you compile this file and link it
31 // with other works to produce a work based on this file, this file does not
32 // by itself cause the resulting work to be covered by the GNU General Public
33 // License. However the source code for this file must still be made available
34 // in accordance with section (3) of the GNU General Public License.
35 //
36 // This exception does not invalidate any other reasons why a work based on
37 // this file might be covered by the GNU General Public License.
38 //
39 // Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
40 // at http://sources.redhat.com/ecos/ecos-license/
41 // -------------------------------------------
42 //####ECOSGPLCOPYRIGHTEND####
43 //=============================================================================
44 //#####DESCRIPTIONBEGIN####
45 //
46 // Author(s):   andrew.lunn
47 // Contributors:andrew.lunn, jskov
48 // Date:        2001-09-18
49 //
50 //####DESCRIPTIONEND####
51 //
52 //=============================================================================
53
54 #include <network.h>
55 #include <netinet/in.h>
56
57 #ifndef _POSIX_SOURCE
58 /* Initialise the DNS client with the address of the server. The
59    address should be a IPv4 or IPv6 numeric address */
60 __externC int cyg_dns_res_start(char * server);
61
62 /* Old interface which  is deprecated */
63 __externC int cyg_dns_res_init(struct in_addr *dns_server);
64
65 /* Functions to manipulate the domainname */
66 __externC int getdomainname(char *name, size_t len);
67 __externC int setdomainname(const char *name, size_t len);
68 #endif
69
70 // Host name / IP mapping
71 struct hostent {
72     char    *h_name;        /* official name of host */
73     char    **h_aliases;    /* alias list */
74     int     h_addrtype;     /* host address type */
75     int     h_length;       /* length of address */
76     char    **h_addr_list;  /* list of addresses */
77 };
78 #define h_addr  h_addr_list[0]  /* for backward compatibility */
79
80 __externC struct hostent *gethostbyname(const char *host);
81 __externC struct hostent *gethostbyaddr(const char *addr, int len, int type);
82
83 // Error reporting
84 __externC int h_errno;
85 __externC const char* hstrerror(int err);
86
87 #define DNS_SUCCESS  0
88 #define HOST_NOT_FOUND 1
89 #define TRY_AGAIN      2
90 #define NO_RECOVERY    3
91 #define NO_DATA        4
92
93 // Interface between the DNS client and getaddrinfo
94 __externC int 
95 cyg_dns_getaddrinfo(const char * hostname, 
96                     struct sockaddr addrs[], int num,
97                     int family, char **canon);
98 // Interface between the DNS client and getnameinfo
99 __externC int
100 cyg_dns_getnameinfo(const struct sockaddr * sa, char * host, size_t hostlen);
101
102 //-----------------------------------------------------------------------------
103 #endif // CYGONCE_NS_DNS_DNS_H
104 // End of dns.h