1 /* $Id: lukemftp.h,v 1.43 2002/06/10 08:13:01 lukem Exp $ */
3 #define FTP_PRODUCT "lukemftp"
4 #define FTP_VERSION "1.6-beta2"
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>
80 #if USE_GLOB_H /* not set by configure; used by other build systems */
90 #define _PATH_BSHELL "/bin/sh"
93 #define _PATH_TMP "/tmp/"
96 typedef struct _stringlist
{
102 StringList
*sl_init(void);
103 int sl_add(StringList
*, char *);
104 void sl_free(StringList
*, int);
105 char *sl_find(StringList
*, char *);
108 # include <termcap.h>
110 int tgetent(char *, const char *);
111 char *tgetstr(const char *, char **);
112 int tgetflag(const char *);
113 int tgetnum(const char *);
114 char *tgoto(const char *, int, int);
115 void tputs(const char *, int, int (*)(int));
123 # include <libutil.h>
133 typedef unsigned short in_port_t
;
136 #if ! HAVE_SA_FAMILY_T
137 typedef unsigned short sa_family_t
;
141 typedef unsigned int socklen_t
;
144 #if HAVE_AF_INET6 && HAVE_SOCKADDR_IN6
149 #if ! HAVE_RFC2553_NETDB
152 #undef EAI_ADDRFAMILY
153 #define EAI_ADDRFAMILY 1 /* address family for hostname not supported */
155 #define EAI_AGAIN 2 /* temporary failure in name resolution */
157 #define EAI_BADFLAGS 3 /* invalid value for ai_flags */
159 #define EAI_FAIL 4 /* non-recoverable failure in name resolution */
161 #define EAI_FAMILY 5 /* ai_family not supported */
163 #define EAI_MEMORY 6 /* memory allocation failure */
165 #define EAI_NODATA 7 /* no address associated with hostname */
167 #define EAI_NONAME 8 /* hostname nor servname provided, or not known */
169 #define EAI_SERVICE 9 /* servname not supported for ai_socktype */
171 #define EAI_SOCKTYPE 10 /* ai_socktype not supported */
173 #define EAI_SYSTEM 11 /* system error returned in errno */
175 /* KAME extensions? */
177 #define EAI_BADHINTS 12
179 #define EAI_PROTOCOL 13
185 #define NI_MAXHOST 1025
187 #define NI_MAXSERV 32
190 #define NI_NOFQDN 0x00000001
191 #undef NI_NUMERICHOST
192 #define NI_NUMERICHOST 0x00000002
194 #define NI_NAMEREQD 0x00000004
195 #undef NI_NUMERICSERV
196 #define NI_NUMERICSERV 0x00000008
198 #define NI_DGRAM 0x00000010
202 #define AI_PASSIVE 0x00000001 /* get address to use bind() */
204 #define AI_CANONNAME 0x00000002 /* fill ai_canonname */
206 /* KAME extensions ? */
207 #undef AI_NUMERICHOST
208 #define AI_NUMERICHOST 0x00000004 /* prevent name resolution */
210 #define AI_MASK (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST)
214 #define AI_ALL 0x00000100 /* IPv6 and IPv4-mapped (with AI_V4MAPPED) */
215 #undef AI_V4MAPPED_CFG
216 #define AI_V4MAPPED_CFG 0x00000200 /* accept IPv4-mapped if kernel supports */
218 #define AI_ADDRCONFIG 0x00000400 /* only if any address is assigned */
220 #define AI_V4MAPPED 0x00000800 /* accept IPv4-mapped IPv6 address */
222 #endif /* ! HAVE_RFC2553_NETDB */
225 #if ! HAVE_RFC2553_NETDB && ! HAVE_ADDRINFO
228 int ai_flags
; /* AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST */
229 int ai_family
; /* PF_xxx */
230 int ai_socktype
; /* SOCK_xxx */
231 int ai_protocol
; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */
232 size_t ai_addrlen
; /* length of ai_addr */
233 char *ai_canonname
; /* canonical name for hostname */
234 struct sockaddr
*ai_addr
; /* binary address */
235 struct addrinfo
*ai_next
; /* next structure in linked list */
238 int getaddrinfo(const char *, const char *,
239 const struct addrinfo
*, struct addrinfo
**);
240 int getnameinfo(const struct sockaddr
*, socklen_t
, char *,
241 size_t, char *, size_t, int);
242 void freeaddrinfo(struct addrinfo
*);
243 char *gai_strerror(int);
245 #endif /* ! HAVE_RFC2553_NETDB && ! HAVE_ADDRINFO */
249 # define DIRENT_MISSING_D_NAMLEN
255 #define HAVE_H_ERRNO 1 /* XXX: an assumption for now... */
262 char *getpass(const char *);
278 void err(int, const char *, ...);
279 void errx(int, const char *, ...);
280 void warn(const char *, ...);
281 void warnx(const char *, ...);
285 char *fgetln(FILE *, size_t *);
289 int fseeko(FILE *, off_t
, int);
293 # define FPARSELN_UNESCESC 0x01
294 # define FPARSELN_UNESCCONT 0x02
295 # define FPARSELN_UNESCCOMM 0x04
296 # define FPARSELN_UNESCREST 0x08
297 # define FPARSELN_UNESCALL 0x0f
298 char *fparseln(FILE *, size_t *, size_t *, const char[3], int);
302 const char *inet_ntop(int, const void *, char *, size_t);
306 int inet_pton(int, const char *, void *);
313 #if ! HAVE_SETPROGNAME
314 const char *getprogname(void);
315 void setprogname(const char *);
319 int snprintf(char *, size_t, const char *, ...);
323 char *strdup(const char *);
330 #if ! HAVE_STRPTIME || ! HAVE_STRPTIME_D
331 char *strptime(const char *, const char *, struct tm
*);
334 #if HAVE_QUAD_SUPPORT
335 # if ! HAVE_STRTOLL && HAVE_LONG_LONG
336 long long strtoll(const char *, char **, int);
337 # if ! defined(QUAD_MIN)
338 # define QUAD_MIN (-0x7fffffffffffffffL-1)
340 # if ! defined(QUAD_MAX)
341 # define QUAD_MAX (0x7fffffffffffffffL)
344 #else /* ! HAVE_QUAD_SUPPORT */
345 # define NO_LONG_LONG 1
346 #endif /* ! HAVE_QUAD_SUPPORT */
349 time_t timegm(struct tm
*);
357 size_t strlcat(char *, const char *, size_t);
361 size_t strlcpy(char *, const char *, size_t);
365 char *strsep(char **stringp
, const char *delim
);
369 # define memmove(a,b,c) bcopy((b),(a),(c))
370 /* XXX: add others #defines for borken systems? */
373 #if HAVE_GETPASSPHRASE
374 # define getpass getpassphrase
378 # define MIN(a, b) ((a) < (b) ? (a) : (b))
381 # define MAX(a, b) ((a) < (b) ? (b) : (a))
384 #if ! defined(timersub)
385 # define timersub(tvp, uvp, vvp) \
387 (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \
388 (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \
389 if ((vvp)->tv_usec < 0) { \
391 (vvp)->tv_usec += 1000000; \
396 #if ! defined(S_ISLNK)
397 # define S_ISLNK(m) ((m & S_IFMT) == S_IFLNK)
400 #define EPOCH_YEAR 1970
401 #define SECSPERHOUR 3600
402 #define SECSPERDAY 86400
403 #define TM_YEAR_BASE 1900