Importing starttls 0.4+.
[elisp/starttls.git] / getaddrinfo.h
1 /*
2  * getaddrinfo(2) emulation.
3  * Copyright (C) 1988, 1989, 1992, 1993 Free Software Foundation, Inc.
4
5  * Author: Daiki Ueno <daiki@kiss.kake.info.waseda.ac.jp>
6
7 This file is not part of any package.
8
9 GNU Emacs is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2, or (at your option)
12 any later version.
13
14 GNU Emacs is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with GNU Emacs; see the file COPYING.  If not, write to
21 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 Boston, MA 02111-1307, USA.
23  */
24 struct addrinfo {
25   int ai_flags;
26   int ai_family;
27   int ai_socktype;
28   int ai_protocol;
29   size_t ai_addrlen;
30   char *ai_canonname;
31   struct sockaddr *ai_addr;
32   struct addrinfo *ai_next; 
33 };
34
35 /* Possible values for `ai_flags' field in `addrinfo' structure.  */
36 # define AI_PASSIVE     1       /* Socket address is intended for `bind'.  */
37 # define AI_CANONNAME   2       /* Request for canonical name.  */
38 # define AI_NUMERICHOST 4       /* Don't use name resolution.  */
39 # define AI_MASK        7
40
41 /* Error values for `getaddrinfo' function.  */
42 #define EAI_BADFLAGS   -1      /* Invalid value for `ai_flags' field.  */
43 #define EAI_NONAME     -2      /* NAME or SERVICE is unknown.  */
44 #define EAI_AGAIN      -3      /* Temporary failure in name resolution.  */
45 #define EAI_FAIL       -4      /* Non-recoverable failure in name res.  */
46 #define EAI_NODATA     -5      /* No address associated with NAME.  */
47 #define EAI_FAMILY     -6      /* `ai_family' not supported.  */
48 #define EAI_SOCKTYPE   -7      /* `ai_socktype' not supported.  */
49 #define EAI_SERVICE    -8      /* SERVICE not supported for `ai_socktype'.  */
50 #define EAI_ADDRFAMILY -9      /* Address family for NAME not supported.  */
51 #define EAI_MEMORY     -10     /* Memory allocation failure.  */
52 #define EAI_SYSTEM     -11     /* System error returned in `errno'.  */
53
54 #define NI_MAXHOST      1025
55 #define NI_MAXSERV      32
56
57 #define NI_NUMERICHOST 1       /* Don't try to look up hostname.  */
58 #define NI_NUMERICSERV 2       /* Don't convert port number to name.  */
59 #define NI_NOFQDN      4       /* Only return nodename portion.  */
60 #define NI_NAMEREQD    8       /* Don't return numeric addresses.  */
61 #define NI_DGRAM       16      /* Look up UDP service rather than TCP.  */
62
63 extern int getaddrinfo (const char *, const char *, const struct addrinfo *, 
64                         struct addrinfo **);
65
66 extern void freeaddrinfo (struct addrinfo *ai);
67
68
69