1 /* $Id: lukemftp.h,v 1.36 2000/10/11 03:07:36 lukem Exp $ */
3 #define FTP_PRODUCT "lukemftp"
4 #define FTP_VERSION "1.5"
10 #include <sys/ioctl.h>
11 #include <sys/socket.h>
15 #include <netinet/in.h>
16 #include <netinet/in_systm.h>
17 #include <netinet/ip.h>
20 #include <arpa/inet.h>
41 # elif HAVE_SYS_POLL_H
42 # include <sys/poll.h>
47 # error "no poll() or select() found"
53 # define dirent direct
55 # include <sys/ndir.h>
65 #if TIME_WITH_SYS_TIME
66 # include <sys/time.h>
70 # include <sys/time.h>
89 # define _PATH_BSHELL "/bin/sh"
90 # define _PATH_TMP "/tmp/"
93 typedef struct _stringlist {
99 StringList *sl_init(void);
100 int sl_add(StringList *, char *);
101 void sl_free(StringList *, int);
102 char *sl_find(StringList *, char *);
105 # include <termcap.h>
107 int tgetent(char *, const char *);
108 char *tgetstr(const char *, char **);
109 int tgetflag(const char *);
110 int tgetnum(const char *);
111 char *tgoto(const char *, int, int);
112 void tputs(const char *, int, int (*)(int));
126 typedef unsigned short in_port_t;
130 typedef unsigned int socklen_t;
133 #if HAVE_AF_INET6 && HAVE_SOCKADDR_IN6
138 #if ! HAVE_RFC2553_NETDB
141 #undef EAI_ADDRFAMILY
142 #define EAI_ADDRFAMILY 1 /* address family for hostname not supported */
144 #define EAI_AGAIN 2 /* temporary failure in name resolution */
146 #define EAI_BADFLAGS 3 /* invalid value for ai_flags */
148 #define EAI_FAIL 4 /* non-recoverable failure in name resolution */
150 #define EAI_FAMILY 5 /* ai_family not supported */
152 #define EAI_MEMORY 6 /* memory allocation failure */
154 #define EAI_NODATA 7 /* no address associated with hostname */
156 #define EAI_NONAME 8 /* hostname nor servname provided, or not known */
158 #define EAI_SERVICE 9 /* servname not supported for ai_socktype */
160 #define EAI_SOCKTYPE 10 /* ai_socktype not supported */
162 #define EAI_SYSTEM 11 /* system error returned in errno */
164 /* KAME extensions? */
166 #define EAI_BADHINTS 12
168 #define EAI_PROTOCOL 13
174 #define NI_MAXHOST 1025
176 #define NI_MAXSERV 32
179 #define NI_NOFQDN 0x00000001
180 #undef NI_NUMERICHOST
181 #define NI_NUMERICHOST 0x00000002
183 #define NI_NAMEREQD 0x00000004
184 #undef NI_NUMERICSERV
185 #define NI_NUMERICSERV 0x00000008
187 #define NI_DGRAM 0x00000010
191 #define AI_PASSIVE 0x00000001 /* get address to use bind() */
193 #define AI_CANONNAME 0x00000002 /* fill ai_canonname */
195 /* KAME extensions ? */
196 #undef AI_NUMERICHOST
197 #define AI_NUMERICHOST 0x00000004 /* prevent name resolution */
199 #define AI_MASK (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST)
203 #define AI_ALL 0x00000100 /* IPv6 and IPv4-mapped (with AI_V4MAPPED) */
204 #undef AI_V4MAPPED_CFG
205 #define AI_V4MAPPED_CFG 0x00000200 /* accept IPv4-mapped if kernel supports */
207 #define AI_ADDRCONFIG 0x00000400 /* only if any address is assigned */
209 #define AI_V4MAPPED 0x00000800 /* accept IPv4-mapped IPv6 address */
211 #endif /* ! HAVE_RFC2553_NETDB */
214 #if ! HAVE_RFC2553_NETDB && ! HAVE_ADDRINFO
217 int ai_flags; /* AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST */
218 int ai_family; /* PF_xxx */
219 int ai_socktype; /* SOCK_xxx */
220 int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */
221 size_t ai_addrlen; /* length of ai_addr */
222 char *ai_canonname; /* canonical name for hostname */
223 struct sockaddr *ai_addr; /* binary address */
224 struct addrinfo *ai_next; /* next structure in linked list */
227 int getaddrinfo(const char *, const char *,
228 const struct addrinfo *, struct addrinfo **);
229 int getnameinfo(const struct sockaddr *, socklen_t, char *,
230 size_t, char *, size_t, int);
231 void freeaddrinfo(struct addrinfo *);
232 char *gai_strerror(int);
234 #endif /* ! HAVE_RFC2553_NETDB && ! HAVE_ADDRINFO */
238 # define DIRENT_MISSING_D_NAMLEN
244 #define HAVE_H_ERRNO 1 /* XXX: an assumption for now... */
251 char *getpass(const char *);
267 void err(int, const char *, ...);
268 void errx(int, const char *, ...);
269 void warn(const char *, ...);
270 void warnx(const char *, ...);
274 char *fgetln(FILE *, size_t *);
278 # define FPARSELN_UNESCESC 0x01
279 # define FPARSELN_UNESCCONT 0x02
280 # define FPARSELN_UNESCCOMM 0x04
281 # define FPARSELN_UNESCREST 0x08
282 # define FPARSELN_UNESCALL 0x0f
283 char *fparseln(FILE *, size_t *, size_t *, const char[3], int);
287 const char *inet_ntop(int, const void *, char *, size_t);
295 int snprintf(char *, size_t, const char *, ...);
299 char *strdup(const char *);
306 #if ! HAVE_STRPTIME || ! HAVE_STRPTIME_D
307 char *strptime(const char *, const char *, struct tm *);
310 #if HAVE_QUAD_SUPPORT
311 # if ! HAVE_STRTOLL && HAVE_LONG_LONG
312 long long strtoll(const char *, char **, int);
313 # if ! defined(QUAD_MIN)
314 # define QUAD_MIN (-0x7fffffffffffffffL-1)
316 # if ! defined(QUAD_MAX)
317 # define QUAD_MAX (0x7fffffffffffffffL)
320 #else /* ! HAVE_QUAD_SUPPORT */
321 # define NO_LONG_LONG 1
322 #endif /* ! HAVE_QUAD_SUPPORT */
325 time_t timegm(struct tm *);
333 size_t strlcat(char *, const char *, size_t);
337 size_t strlcpy(char *, const char *, size_t);
341 char *strsep(char **stringp, const char *delim);
345 # define memmove(a,b,c) bcopy((b),(a),(c))
346 /* XXX: add others #defines for borken systems? */
349 #if HAVE_GETPASSPHRASE
350 # define getpass getpassphrase
354 # define MIN(a, b) ((a) < (b) ? (a) : (b))
357 # define MAX(a, b) ((a) < (b) ? (b) : (a))
360 #if ! defined(timersub)
361 # define timersub(tvp, uvp, vvp) \
363 (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \
364 (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \
365 if ((vvp)->tv_usec < 0) { \
367 (vvp)->tv_usec += 1000000; \
372 #if ! defined(S_ISLNK)
373 # define S_ISLNK(m) ((m & S_IFMT) == S_IFLNK)
376 #define EPOCH_YEAR 1970
377 #define SECSPERHOUR 3600
378 #define SECSPERDAY 86400
379 #define TM_YEAR_BASE 1900