mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-04-02 12:32:55 +00:00
getting netlib to build with WIN32_LEAN_AND_MEAN defined
This commit is contained in:
parent
4475243a7d
commit
1ebf1f404e
@ -45,7 +45,7 @@
|
||||
MODULE_PRIVATE Bool
|
||||
pacf_get_proxy_addr(MWContext *context, char *list,
|
||||
char ** ret_proxy_addr,
|
||||
u_long * ret_socks_addr,
|
||||
unsigned long * ret_socks_addr,
|
||||
short * ret_socks_port);
|
||||
|
||||
|
||||
|
@ -134,11 +134,11 @@ struct _TCP_ConData {
|
||||
|
||||
/* Global TCP connect variables
|
||||
*/
|
||||
PUBLIC u_long NET_SocksHost=0;
|
||||
PUBLIC unsigned long NET_SocksHost=0;
|
||||
PUBLIC short NET_SocksPort=0;
|
||||
PUBLIC char * NET_SocksHostName=0;
|
||||
|
||||
PUBLIC Bool socksFailure=FALSE;
|
||||
PUBLIC PRBool socksFailure=FALSE;
|
||||
|
||||
PUBLIC int NET_InGetHostByName = FALSE; /* global semaphore */
|
||||
|
||||
@ -178,7 +178,7 @@ NET_SetTCPConnectTimeout(uint32 seconds) {
|
||||
*/
|
||||
int NET_SetSocksHost(char * host)
|
||||
{
|
||||
XP_Bool is_numeric_ip;
|
||||
PRBool is_numeric_ip;
|
||||
char *host_cp;
|
||||
|
||||
#ifdef MOZ_OFFLINE
|
||||
@ -223,11 +223,15 @@ int NET_SetSocksHost(char * host)
|
||||
|
||||
if (is_numeric_ip) /* Numeric node address */
|
||||
{
|
||||
PRNetAddr netAddr;
|
||||
PRStatus status;
|
||||
TRACEMSG(("Socks host is numeric"));
|
||||
|
||||
/* some systems return a number instead of a struct
|
||||
*/
|
||||
NET_SocksHost = inet_addr(host);
|
||||
/* some systems return a number instead of a struct */
|
||||
status = PR_StringToNetAddr(host, &netAddr);
|
||||
if (PR_SUCCESS == status) {
|
||||
NET_SocksHost = netAddr.inet.ip;
|
||||
}
|
||||
if (NET_SocksHostName) PR_Free (NET_SocksHostName);
|
||||
NET_SocksHostName = PL_strdup(host);
|
||||
}
|
||||
@ -256,7 +260,7 @@ int NET_SetSocksHost(char * host)
|
||||
socksFailure=TRUE;
|
||||
return 0; /* Fail? */
|
||||
}
|
||||
memcpy(&NET_SocksHost, hp->h_addr, hp->h_length);
|
||||
memcpy(&NET_SocksHost, hp->h_addr_list[0], hp->h_length);
|
||||
}
|
||||
if (cp) {
|
||||
*cp = ':';
|
||||
@ -442,33 +446,6 @@ net_CheckDNSCache(CONST char * hostname)
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* print an IP address from a sockaddr struct
|
||||
*
|
||||
* This routine is only used for TRACE messages
|
||||
*/
|
||||
#if defined(XP_WIN) || defined(XP_OS2)
|
||||
MODULE_PRIVATE char *CONST
|
||||
NET_IpString (struct sockaddr_in *sin)
|
||||
#else
|
||||
MODULE_PRIVATE CONST char *
|
||||
NET_IpString (struct sockaddr_in *sin)
|
||||
#endif
|
||||
{
|
||||
static char buffer[32];
|
||||
int a,b,c,d;
|
||||
unsigned char *pc;
|
||||
|
||||
pc = (unsigned char *) &sin->sin_addr;
|
||||
|
||||
a = (int) *pc;
|
||||
b = (int) *(++pc);
|
||||
c = (int) *(++pc);
|
||||
d = (int) *(++pc);
|
||||
PR_snprintf(buffer, sizeof(buffer), "%d.%d.%d.%d", a,b,c,d);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/* a list of dis-allowed ports for gopher connections for security reasons */
|
||||
PRIVATE int net_bad_ports_table[] = {
|
||||
1, 7, 9, 11, 13, 15, 17, 19, 20,
|
||||
@ -750,13 +727,18 @@ net_FindAddress (const char *host_ptr,
|
||||
* code uses for host lookup to be a specific ip address. */
|
||||
static char firstTime = 1;
|
||||
if (firstTime) {
|
||||
PRNetAddr netAddr;
|
||||
PRStatus status;
|
||||
char *ns = getenv("SOCKS_NS");
|
||||
firstTime = 0;
|
||||
if (ns && ns[0]) {
|
||||
/* Use a specific host for dns lookups */
|
||||
extern int res_init (void);
|
||||
res_init();
|
||||
_res.nsaddr_list[0].sin_addr.s_addr = inet_addr(ns);
|
||||
status = PR_StringToNetAddr(ns, &netAddr);
|
||||
if (PR_SUCCESS == status) {
|
||||
_res.nsaddr_list[0].sin_addr.s_addr = netAddr.inet.ip;
|
||||
}
|
||||
_res.nscount = 1;
|
||||
}
|
||||
}
|
||||
@ -1052,7 +1034,7 @@ NET_BeginConnect (CONST char *url,
|
||||
TCP_ConData **tcp_con_data,
|
||||
MWContext *window_id,
|
||||
char **error_msg,
|
||||
u_long socks_host,
|
||||
unsigned long socks_host,
|
||||
short socks_port,
|
||||
PRUint32 localIP)
|
||||
{
|
||||
|
@ -76,7 +76,7 @@ typedef struct _ActiveEntry {
|
||||
|
||||
char * proxy_conf; /* Proxy autoconfig string */
|
||||
char * proxy_addr; /* Proxy address in host:port format */
|
||||
u_long socks_host; /* SOCKS host IP address */
|
||||
unsigned long socks_host; /* SOCKS host IP address */
|
||||
short socks_port; /* SOCKS port number */
|
||||
|
||||
} ActiveEntry;
|
||||
|
@ -27,7 +27,7 @@ typedef struct _TCP_ConData TCP_ConData;
|
||||
|
||||
/* the socks host in U long form
|
||||
*/
|
||||
extern u_long NET_SocksHost;
|
||||
extern unsigned long NET_SocksHost;
|
||||
extern short NET_SocksPort;
|
||||
extern char *NET_SocksHostName;
|
||||
|
||||
@ -55,19 +55,6 @@ NET_DebugNetWrite (PRFileDesc *fildes, CONST void *buf, unsigned nbyte);
|
||||
extern int32
|
||||
NET_BlockingWrite (PRFileDesc *filedes, CONST void * buf, unsigned int nbyte);
|
||||
|
||||
|
||||
/* print an IP address from a sockaddr struct
|
||||
*
|
||||
* This routine is only used for TRACE messages
|
||||
*/
|
||||
#if defined(XP_WIN) || defined(XP_OS2)
|
||||
extern char *CONST
|
||||
NET_IpString (struct sockaddr_in* sin);
|
||||
#else
|
||||
extern const char *
|
||||
NET_IpString (struct sockaddr_in* sin);
|
||||
#endif
|
||||
|
||||
/* free left over tcp connection data if there is any
|
||||
*/
|
||||
extern void NET_FreeTCPConData(TCP_ConData * data);
|
||||
@ -91,7 +78,7 @@ NET_BeginConnect (CONST char *url,
|
||||
TCP_ConData **tcp_con_data,
|
||||
MWContext *window_id,
|
||||
char **error_msg,
|
||||
u_long socks_host,
|
||||
unsigned long socks_host,
|
||||
short socks_port,
|
||||
PRUint32 localIP);
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
*/
|
||||
#ifdef XP_PC
|
||||
#include <windows.h>
|
||||
#include <winsock2.h>
|
||||
#include "net.h"
|
||||
#include "nsISupports.h"
|
||||
#include "merrors.h"
|
||||
|
Loading…
x
Reference in New Issue
Block a user