comparison lib/gftp.h @ 944:5b681cba67b2

2008-01-24 Brian Masney <masneyb@gftp.org> * lib/gftp.h lib/rfc959.c lib/protocols.c lib/misc.c - don't store the structure from getaddrinfo()/gethostbyname() in the gftp_request structure. Instead, store the address of the current server in a separate pointer.
author masneyb
date Thu, 24 Jan 2008 23:31:26 +0000
parents 7b5aa0420fe2
children c7d7a081cd9c
comparison
equal deleted inserted replaced
943:ca75331d0f82 944:5b681cba67b2
103 103
104 #ifndef AF_LOCAL 104 #ifndef AF_LOCAL
105 #define AF_LOCAL AF_UNIX 105 #define AF_LOCAL AF_UNIX
106 #endif 106 #endif
107 107
108 #ifdef HAVE_GETADDRINFO
109 #define HAVE_IPV6
110 #define GFTP_GET_AI_FAMILY(request) ((request) != NULL && (request)->hostp != NULL ? (request)->hostp->ai_family : -1)
111 #else
112 #define GFTP_GET_AI_FAMILY(request) AF_INET
113 #endif
114
115 /* Solaris needs this included for major()/minor() */ 108 /* Solaris needs this included for major()/minor() */
116 #ifdef HAVE_SYS_MKDEV_H 109 #ifdef HAVE_SYS_MKDEV_H
117 #include <sys/mkdev.h> 110 #include <sys/mkdev.h>
118 #endif 111 #endif
119 112
157 150
158 #ifdef __GNUC__ 151 #ifdef __GNUC__
159 # define GFTP_LOG_FUNCTION_ATTRIBUTES __attribute__((format(printf, 3, 4))) 152 # define GFTP_LOG_FUNCTION_ATTRIBUTES __attribute__((format(printf, 3, 4)))
160 #else 153 #else
161 # define GFTP_LOG_FUNCTION_ATTRIBUTES 154 # define GFTP_LOG_FUNCTION_ATTRIBUTES
155 #endif
156
157 #if defined (HAVE_GETADDRINFO) && defined (HAVE_GAI_STRERROR)
158 # define HAVE_IPV6
162 #endif 159 #endif
163 160
164 #if defined (_LARGEFILE_SOURCE) && !defined (__hppa__) && !defined (__hppa) 161 #if defined (_LARGEFILE_SOURCE) && !defined (__hppa__) && !defined (__hppa)
165 #define GFTP_OFF_T_HEX_PRINTF_MOD "%llx" 162 #define GFTP_OFF_T_HEX_PRINTF_MOD "%llx"
166 #define GFTP_OFF_T_INTL_PRINTF_MOD "%'lld" 163 #define GFTP_OFF_T_INTL_PRINTF_MOD "%'lld"
386 int datafd, /* Data connection */ 383 int datafd, /* Data connection */
387 cachefd; /* For the directory cache */ 384 cachefd; /* For the directory cache */
388 int wakeup_main_thread[2]; /* FD that gets written to by the threads 385 int wakeup_main_thread[2]; /* FD that gets written to by the threads
389 to wakeup the parent */ 386 to wakeup the parent */
390 387
391 /* One of these are used to lookup the IP address of the host we are
392 connecting to */
393 #if defined (HAVE_GETADDRINFO) && defined (HAVE_GAI_STRERROR) 388 #if defined (HAVE_GETADDRINFO) && defined (HAVE_GAI_STRERROR)
394 struct addrinfo *hostp, 389 void *remote_addr;
395 *current_hostp; 390 size_t remote_addr_len;
396 #else 391 #endif
397 struct hostent host, *hostp;
398 int curhost;
399 #endif
400
401 int ai_family; 392 int ai_family;
393
402 int server_type; /* The type of server we are connected to. 394 int server_type; /* The type of server we are connected to.
403 See GFTP_DIRTYPE_* above */ 395 See GFTP_DIRTYPE_* above */
404 unsigned int free_hostp : 1, /* Should we free the hostp structure 396 unsigned int use_proxy : 1,
405 in gftp_destroy_request() */
406 use_proxy : 1,
407 always_connected : 1, 397 always_connected : 1,
408 need_hostport : 1, 398 need_hostport : 1,
409 need_username : 1, 399 need_username : 1,
410 need_password : 1, 400 need_password : 1,
411 use_cache : 1, /* Enable or disable the cache */ 401 use_cache : 1, /* Enable or disable the cache */
1021 int gftp_connect_server ( gftp_request * request, 1011 int gftp_connect_server ( gftp_request * request,
1022 char *service, 1012 char *service,
1023 char *proxy_hostname, 1013 char *proxy_hostname,
1024 unsigned int proxy_port ); 1014 unsigned int proxy_port );
1025 1015
1026 #if !defined (HAVE_GETADDRINFO) || !defined (HAVE_GAI_STRERROR)
1027
1028 struct hostent *r_gethostbyname ( const char *name, 1016 struct hostent *r_gethostbyname ( const char *name,
1029 struct hostent *result_buf, 1017 struct hostent *result_buf,
1030 int *h_errnop ); 1018 int *h_errnop );
1031
1032 #endif
1033 1019
1034 struct servent *r_getservbyname ( const char *name, 1020 struct servent *r_getservbyname ( const char *name,
1035 const char *proto, 1021 const char *proto,
1036 /*@out@*/ struct servent *result_buf, 1022 /*@out@*/ struct servent *result_buf,
1037 int *h_errnop ); 1023 int *h_errnop );