Reversed the logic for sockaddr_storage and made our own Curl_sockaddr_storage

struct instead to use.
This commit is contained in:
Daniel Stenberg 2005-11-12 22:10:42 +00:00
parent be524fed38
commit a5da1219bb
3 changed files with 13 additions and 11 deletions

View File

@ -94,7 +94,7 @@
#include "inet_ntop.h" #include "inet_ntop.h"
#include "select.h" #include "select.h"
#include "parsedate.h" /* for the week day and month names */ #include "parsedate.h" /* for the week day and month names */
#include "sockaddr.h" /* required for sockaddr_storage */ #include "sockaddr.h" /* required for Curl_sockaddr_storage */
#if defined(HAVE_INET_NTOA_R) && !defined(HAVE_INET_NTOA_R_DECL) #if defined(HAVE_INET_NTOA_R) && !defined(HAVE_INET_NTOA_R_DECL)
#include "inet_ntoa_r.h" #include "inet_ntoa_r.h"
@ -778,7 +778,7 @@ static CURLcode ftp_state_use_port(struct connectdata *conn,
/****************************************************************** /******************************************************************
* IPv6-specific section * IPv6-specific section
*/ */
struct sockaddr_storage ss; struct Curl_sockaddr_storage ss;
struct addrinfo *res, *ai; struct addrinfo *res, *ai;
socklen_t sslen; socklen_t sslen;
char hbuf[NI_MAXHOST]; char hbuf[NI_MAXHOST];

View File

@ -26,11 +26,13 @@
#include "setup.h" #include "setup.h"
#ifndef HAVE_STRUCT_SOCKADDR_STORAGE #ifndef HAVE_STRUCT_SOCKADDR_STORAGE
struct sockaddr_storage struct Curl_sockaddr_storage {
{ struct sockaddr_storage buffer;
char buffer[256]; /* this should be big enough to fit a lot */ }
}; #else
struct Curl_sockaddr_storage {
char buffer[256]; /* this should be big enough to fit a lot */
};
#endif #endif
#endif /* __SOCKADDR_H */ #endif /* __SOCKADDR_H */

View File

@ -75,7 +75,7 @@
#include "progress.h" #include "progress.h"
#include "connect.h" #include "connect.h"
#include "strerror.h" #include "strerror.h"
#include "sockaddr.h" /* required for sockaddr_storage */ #include "sockaddr.h" /* required for Curl_sockaddr_storage */
#define _MPRINTF_REPLACE /* use our functions only */ #define _MPRINTF_REPLACE /* use our functions only */
#include <curl/mprintf.h> #include <curl/mprintf.h>
@ -157,9 +157,9 @@ typedef struct tftp_state_data {
time_t start_time; time_t start_time;
time_t max_time; time_t max_time;
unsigned short block; unsigned short block;
struct sockaddr_storage local_addr; struct Curl_sockaddr_storage local_addr;
socklen_t local_addrlen; socklen_t local_addrlen;
struct sockaddr_storage remote_addr; struct Curl_sockaddr_storage remote_addr;
socklen_t remote_addrlen; socklen_t remote_addrlen;
int rbytes; int rbytes;
int sbytes; int sbytes;
@ -598,7 +598,7 @@ CURLcode Curl_tftp(struct connectdata *conn, bool *done)
tftp_event_t event; tftp_event_t event;
CURLcode code; CURLcode code;
int rc; int rc;
struct sockaddr_storage fromaddr; struct Curl_sockaddr_storage fromaddr;
socklen_t fromlen; socklen_t fromlen;
int check_time = 0; int check_time = 0;