<article>
<title>Squid Programmers Guide</title>
<author>Squid Developers</author>
-<date>$Id: prog-guide.sgml,v 1.57 2004/08/11 19:23:21 wessels Exp $</date>
+<date>$Id: prog-guide.sgml,v 1.58 2005/04/18 21:52:40 hno Exp $</date>
<abstract>
Squid is a WWW Cache application developed by the National Laboratory
} flags;
long expiretime;
/* IP addr this user authenticated from */
- struct in_addr ipaddr;
+ struct IN_ADDR ipaddr;
time_t ip_expiretime;
/* how many references are outstanding to this instance*/
size_t references;
struct redirect_addr {
- struct in_addr ip_addr;
+ struct IN_ADDR ip_addr;
int port;
redirect_ptr next;
/* Resolve a name into an address */
int
-RFCNB_Name_To_IP(char *host, struct in_addr *Dest_IP)
+RFCNB_Name_To_IP(char *host, struct IN_ADDR *Dest_IP)
{
int addr; /* Assumes IP4, 32 bit network addresses */
struct hostent *hp;
} else { /* We got a name */
- memcpy((void *) Dest_IP, (void *) hp->h_addr_list[0], sizeof(struct in_addr));
+ memcpy((void *) Dest_IP, (void *) hp->h_addr_list[0], sizeof(struct IN_ADDR));
}
} else { /* It was an IP address */
- memcpy((void *) Dest_IP, (void *) &addr, sizeof(struct in_addr));
+ memcpy((void *) Dest_IP, (void *) &addr, sizeof(struct IN_ADDR));
}
* Not sure how to handle socket options etc. */
int
-RFCNB_IP_Connect(struct in_addr Dest_IP, int port)
+RFCNB_IP_Connect(struct IN_ADDR Dest_IP, int port)
{
struct sockaddr_in Socket;
int fd;
char *Called_Name,
char *Calling_Name,
BOOL * redirect,
- struct in_addr *Dest_IP,
+ struct IN_ADDR *Dest_IP,
int *port)
{
char *sess_pkt;
*redirect = TRUE; /* Copy port and ip addr */
- memcpy(Dest_IP, (resp + RFCNB_Pkt_IP_Offset), sizeof(struct in_addr));
+ memcpy(Dest_IP, (resp + RFCNB_Pkt_IP_Offset), sizeof(struct IN_ADDR));
*port = SVAL(resp, RFCNB_Pkt_Port_Offset);
return (0);
void RFCNB_Print_Pkt(FILE * fd, char *dirn, struct RFCNB_Pkt *pkt, int len);
-int RFCNB_Name_To_IP(char *host, struct in_addr *Dest_IP);
+int RFCNB_Name_To_IP(char *host, struct IN_ADDR *Dest_IP);
int RFCNB_Close(int socket);
-int RFCNB_IP_Connect(struct in_addr Dest_IP, int port);
+int RFCNB_IP_Connect(struct IN_ADDR Dest_IP, int port);
int RFCNB_Session_Req(RFCNB_Con * con,
char *Called_Name,
char *Calling_Name,
BOOL * redirect,
- struct in_addr *Dest_IP,
+ struct IN_ADDR *Dest_IP,
int *port);
void RFCNB_Free_Pkt(struct RFCNB_Pkt *pkt);
int port)
{
struct RFCNB_Con *con;
- struct in_addr Dest_IP;
+ struct IN_ADDR Dest_IP;
int Client;
BOOL redirect;
struct redirect_addr *redir_addr;
struct redirect_addr {
- struct in_addr ip_addr;
+ struct IN_ADDR ip_addr;
int port;
redirect_ptr next;
/* Resolve a name into an address */
int
-RFCNB_Name_To_IP(char *host, struct in_addr *Dest_IP)
+RFCNB_Name_To_IP(char *host, struct IN_ADDR *Dest_IP)
{
int addr; /* Assumes IP4, 32 bit network addresses */
struct hostent *hp;
} else { /* We got a name */
- memcpy((void *) Dest_IP, (void *) hp->h_addr_list[0], sizeof(struct in_addr));
+ memcpy((void *) Dest_IP, (void *) hp->h_addr_list[0], sizeof(struct IN_ADDR));
}
} else { /* It was an IP address */
- memcpy((void *) Dest_IP, (void *) &addr, sizeof(struct in_addr));
+ memcpy((void *) Dest_IP, (void *) &addr, sizeof(struct IN_ADDR));
}
* Not sure how to handle socket options etc. */
int
-RFCNB_IP_Connect(struct in_addr Dest_IP, int port)
+RFCNB_IP_Connect(struct IN_ADDR Dest_IP, int port)
{
struct sockaddr_in Socket;
int fd;
char *Called_Name,
char *Calling_Name,
BOOL * redirect,
- struct in_addr *Dest_IP,
+ struct IN_ADDR *Dest_IP,
int *port)
{
char *sess_pkt;
*redirect = TRUE; /* Copy port and ip addr */
- memcpy(Dest_IP, (resp + RFCNB_Pkt_IP_Offset), sizeof(struct in_addr));
+ memcpy(Dest_IP, (resp + RFCNB_Pkt_IP_Offset), sizeof(struct IN_ADDR));
*port = SVAL(resp, RFCNB_Pkt_Port_Offset);
return (0);
void RFCNB_Print_Pkt(FILE * fd, char *dirn, struct RFCNB_Pkt *pkt, int len);
-int RFCNB_Name_To_IP(char *host, struct in_addr *Dest_IP);
+int RFCNB_Name_To_IP(char *host, struct IN_ADDR *Dest_IP);
int RFCNB_Close(int socket);
-int RFCNB_IP_Connect(struct in_addr Dest_IP, int port);
+int RFCNB_IP_Connect(struct IN_ADDR Dest_IP, int port);
int RFCNB_Session_Req(struct RFCNB_Con *con,
char *Called_Name,
char *Calling_Name,
BOOL * redirect,
- struct in_addr *Dest_IP,
+ struct IN_ADDR *Dest_IP,
int *port);
int port)
{
struct RFCNB_Con *con;
- struct in_addr Dest_IP;
+ struct IN_ADDR Dest_IP;
int Client;
BOOL redirect;
struct redirect_addr *redir_addr;
/*
- * $Id: config.h,v 1.16 2004/12/24 01:03:39 hno Exp $
+ * $Id: config.h,v 1.17 2005/04/18 21:52:40 hno Exp $
*
* AUTHOR: Duane Wessels
*
+/*
+ * This is hack to allow compiling IPv6-IPv4 version,
+ * not disturbing branches others than squid3-ipv6
+ */
+
+#ifdef INET6
+#define IN_ADDR in6_addr
+#else
+#define IN_ADDR in_addr
+#endif
+
/* Typedefs for missing entries on a system */
#include "squid_types.h"
/*
- * $Id: rfc1035.h,v 1.10 2003/12/18 01:16:01 robertc Exp $
+ * $Id: rfc1035.h,v 1.11 2005/04/18 21:52:40 hno Exp $
*
* AUTHOR: Duane Wessels
*
SQUIDCEXTERN unsigned short rfc1035BuildAQuery(const char *hostname,
char *buf,
size_t * szp);
-SQUIDCEXTERN unsigned short rfc1035BuildPTRQuery(const struct in_addr,
+SQUIDCEXTERN unsigned short rfc1035BuildPTRQuery(const struct IN_ADDR,
char *buf,
size_t * szp);
SQUIDCEXTERN unsigned short rfc1035RetryQuery(char *);
/*
- * $Id: util.h,v 1.71 2003/07/07 22:44:28 robertc Exp $
+ * $Id: util.h,v 1.72 2005/04/18 21:52:40 hno Exp $
*
* AUTHOR: Harvest Derived
*
extern void xmalloc_find_leaks(void);
#endif
-typedef struct in_addr SIA;
+typedef struct IN_ADDR SIA;
SQUIDCEXTERN int safe_inet_addr(const char *, SIA *);
SQUIDCEXTERN time_t parse_iso3307_time(const char *buf);
SQUIDCEXTERN char *base64_decode(const char *coded);
/*
- * $Id: rfc1035.c,v 1.35 2005/01/23 14:59:06 serassio Exp $
+ * $Id: rfc1035.c,v 1.36 2005/04/18 21:52:40 hno Exp $
*
* Low level DNS protocol routines
* AUTHOR: Duane Wessels
* Return value is the query ID.
*/
unsigned short
-rfc1035BuildPTRQuery(const struct in_addr addr, char *buf, size_t * szp)
+rfc1035BuildPTRQuery(const struct IN_ADDR addr, char *buf, size_t * szp)
{
static rfc1035_header h;
size_t offset = 0;
S.sin_port = htons(atoi(argv[2]));
S.sin_addr.s_addr = inet_addr(argv[1]);
while (fgets(input, 512, stdin)) {
- struct in_addr junk;
+ struct IN_ADDR junk;
strtok(input, "\r\n");
memset(buf, '\0', 512);
sz = 512;
printf("%d answers\n", n);
for (i = 0; i < n; i++) {
if (answers[i].type == RFC1035_TYPE_A) {
- struct in_addr a;
+ struct IN_ADDR a;
memcpy(&a, answers[i].rdata, 4);
printf("A\t%d\t%s\n", answers[i].ttl, inet_ntoa(a));
} else if (answers[i].type == RFC1035_TYPE_PTR) {
/*
- * $Id: safe_inet_addr.c,v 1.13 2003/01/23 00:37:01 robertc Exp $
+ * $Id: safe_inet_addr.c,v 1.14 2005/04/18 21:52:40 hno Exp $
*/
#include "config.h"
#include "snprintf.h"
int
-safe_inet_addr(const char *buf, struct in_addr *addr)
+safe_inet_addr(const char *buf, struct IN_ADDR *addr)
{
static char addrbuf[32];
int a1 = 0, a2 = 0, a3 = 0, a4 = 0;
- struct in_addr A;
+ struct IN_ADDR A;
char x;
#if defined(_SQUID_HPUX_)
/*
/*
- * $Id: ACLARP.cc,v 1.11 2005/01/06 10:44:39 serassio Exp $
+ * $Id: ACLARP.cc,v 1.12 2005/04/18 21:52:41 hno Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Duane Wessels
#endif
static void aclParseArpList(SplayNode<acl_arp_data *> **curlist);
static int decode_eth(const char *asc, char *eth);
-static int aclMatchArp(SplayNode<acl_arp_data *> **dataptr, struct in_addr c);
+static int aclMatchArp(SplayNode<acl_arp_data *> **dataptr, struct IN_ADDR c);
static SplayNode<acl_arp_data *>::SPLAYCMP aclArpCompare;
static SplayNode<acl_arp_data *>::SPLAYWALKEE aclDumpArpListWalkee;
/* aclMatchArp */
/***************/
int
-aclMatchArp(SplayNode<acl_arp_data *> **dataptr, struct in_addr c)
+aclMatchArp(SplayNode<acl_arp_data *> **dataptr, struct IN_ADDR c)
{
#if defined(_SQUID_LINUX_)
/*
- * $Id: ACLASN.h,v 1.5 2004/08/30 05:12:31 robertc Exp $
+ * $Id: ACLASN.h,v 1.6 2005/04/18 21:52:41 hno Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
#include "ACLStrategised.h"
#include "ACLChecklist.h"
-SQUIDCEXTERN int asnMatchIp(List<int> *, struct in_addr);
+SQUIDCEXTERN int asnMatchIp(List<int> *, struct IN_ADDR);
SQUIDCEXTERN void asnInit(void);
SQUIDCEXTERN void asnFreeMemory(void);
-class ACLASN : public ACLData<struct in_addr>
+class ACLASN : public ACLData<struct IN_ADDR>
{
public:
virtual ~ACLASN();
- virtual bool match(struct in_addr);
+ virtual bool match(struct IN_ADDR);
virtual wordlist *dump();
virtual void parse();
- virtual ACLData<struct in_addr> *clone() const;
+ virtual ACLData<struct IN_ADDR> *clone() const;
virtual void prepareForUse();
private:
static ACL::Prototype SourceRegistryProtoype;
- static ACLStrategised<struct in_addr> SourceRegistryEntry_;
+ static ACLStrategised<struct IN_ADDR> SourceRegistryEntry_;
static ACL::Prototype DestinationRegistryProtoype;
- static ACLStrategised<struct in_addr> DestinationRegistryEntry_;
+ static ACLStrategised<struct IN_ADDR> DestinationRegistryEntry_;
List<int> *data;
};
/*
- * $Id: ACLChecklist.cc,v 1.25 2004/12/27 15:57:15 hno Exp $
+ * $Id: ACLChecklist.cc,v 1.26 2005/04/18 21:52:41 hno Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Duane Wessels
sourceDomainChecked_(false)
{
- memset (&src_addr, '\0', sizeof (struct in_addr));
+ memset (&src_addr, '\0', sizeof (struct IN_ADDR));
- memset (&dst_addr, '\0', sizeof (struct in_addr));
+ memset (&dst_addr, '\0', sizeof (struct IN_ADDR));
- memset (&my_addr, '\0', sizeof (struct in_addr));
+ memset (&my_addr, '\0', sizeof (struct IN_ADDR));
rfc931[0] = '\0';
}
/*
- * $Id: ACLChecklist.h,v 1.19 2003/09/21 12:06:06 robertc Exp $
+ * $Id: ACLChecklist.h,v 1.20 2005/04/18 21:52:41 hno Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
const acl_access *accessList;
- struct in_addr src_addr;
+ struct IN_ADDR src_addr;
- struct in_addr dst_addr;
+ struct IN_ADDR dst_addr;
- struct in_addr my_addr;
+ struct IN_ADDR my_addr;
unsigned short my_port;
HttpRequest *request;
/* for acls that look at reply data */
/*
- * $Id: ACLDestinationASN.h,v 1.1 2003/02/25 12:22:33 robertc Exp $
+ * $Id: ACLDestinationASN.h,v 1.2 2005/04/18 21:52:41 hno Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
#include "ACLASN.h"
#include "ACLStrategy.h"
-class ACLDestinationASNStrategy : public ACLStrategy<struct in_addr>
+class ACLDestinationASNStrategy : public ACLStrategy<struct IN_ADDR>
{
public:
aclIpAddrNetworkCompare(acl_ip_data * const &p, acl_ip_data * const &q)
{
- struct in_addr A = p->addr1;
+ struct IN_ADDR A = p->addr1;
- const struct in_addr B = q->addr1;
+ const struct IN_ADDR B = q->addr1;
- const struct in_addr C = q->addr2;
+ const struct IN_ADDR C = q->addr2;
A.s_addr &= q->mask.s_addr; /* apply netmask */
if (C.s_addr == 0) { /* single address check */
*/
bool
-acl_ip_data::DecodeMask(const char *asc, struct in_addr *mask)
+acl_ip_data::DecodeMask(const char *asc, struct IN_ADDR *mask)
{
char junk;
int a1 = 0;
int
-ACLIP::match(struct in_addr &clientip)
+ACLIP::match(struct IN_ADDR &clientip)
{
static acl_ip_data ClientAddress (any_addr, any_addr, no_addr, NULL);
/*
acl_ip_data::acl_ip_data () :addr1(any_addr), addr2(any_addr), mask (any_addr), next (NULL) {}
-acl_ip_data::acl_ip_data (struct in_addr const &anAddress1, struct in_addr const &anAddress2, struct in_addr const &aMask, acl_ip_data *aNext) : addr1(anAddress1), addr2(anAddress2), mask(aMask), next(aNext){}
+acl_ip_data::acl_ip_data (struct IN_ADDR const &anAddress1, struct IN_ADDR const &anAddress2, struct IN_ADDR const &aMask, acl_ip_data *aNext) : addr1(anAddress1), addr2(anAddress2), mask(aMask), next(aNext){}
acl_ip_data ();
- acl_ip_data (struct in_addr const &, struct in_addr const &, struct in_addr const &, acl_ip_data *);
+ acl_ip_data (struct IN_ADDR const &, struct IN_ADDR const &, struct IN_ADDR const &, acl_ip_data *);
void toStr(char *buf, int len) const;
- struct in_addr addr1; /* if addr2 non-zero then its a range */
+ struct IN_ADDR addr1; /* if addr2 non-zero then its a range */
- struct in_addr addr2;
+ struct IN_ADDR addr2;
- struct in_addr mask;
+ struct IN_ADDR mask;
acl_ip_data *next; /* used for parsing, not for storing */
private:
- static bool DecodeMask(const char *asc, struct in_addr *mask);
+ static bool DecodeMask(const char *asc, struct IN_ADDR *mask);
};
MEMPROXY_CLASS_INLINE(acl_ip_data)
protected:
- int match(struct in_addr &);
+ int match(struct IN_ADDR &);
IPSplay *data;
private:
/*
- * $Id: ACLMaxUserIP.cc,v 1.6 2004/08/30 05:12:31 robertc Exp $
+ * $Id: ACLMaxUserIP.cc,v 1.7 2005/04/18 21:52:41 hno Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Duane Wessels
int
ACLMaxUserIP::match(auth_user_request_t * auth_user_request,
- struct in_addr const &src_addr)
+ struct IN_ADDR const &src_addr)
{
/*
* the logic for flush the ip list when the limit is hit vs keep
/*
- * $Id: ACLMaxUserIP.h,v 1.4 2004/08/30 05:12:31 robertc Exp $
+ * $Id: ACLMaxUserIP.h,v 1.5 2005/04/18 21:52:41 hno Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
static Prototype RegistryProtoype;
static ACLMaxUserIP RegistryEntry_;
- int match(auth_user_request_t *, struct in_addr const &);
+ int match(auth_user_request_t *, struct IN_ADDR const &);
char const *class_;
size_t maximum;
/*
- * $Id: ACLSourceASN.h,v 1.1 2003/02/25 12:22:34 robertc Exp $
+ * $Id: ACLSourceASN.h,v 1.2 2005/04/18 21:52:41 hno Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
#include "ACLASN.h"
#include "ACLStrategy.h"
-class ACLSourceASNStrategy : public ACLStrategy<struct in_addr>
+class ACLSourceASNStrategy : public ACLStrategy<struct IN_ADDR>
{
public:
/*
- * $Id: AccessLogEntry.h,v 1.3 2003/10/16 21:40:16 robertc Exp $
+ * $Id: AccessLogEntry.h,v 1.4 2005/04/18 21:52:41 hno Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
memset(&caddr, '\0', sizeof(caddr));
}
- struct in_addr caddr;
+ struct IN_ADDR caddr;
size_t size;
off_t highOffset;
size_t objectSize;
/*
- * $Id: AuthUserRequest.cc,v 1.2 2004/12/20 17:35:58 robertc Exp $
+ * $Id: AuthUserRequest.cc,v 1.3 2005/04/18 21:52:41 hno Exp $
*
* DO NOT MODIFY NEXT 2 LINES:
* arch-tag: 6803fde1-d5a2-4c29-9034-1c0c9f650eb4
static void
-authenticateAuthUserRequestSetIp(auth_user_request_t * auth_user_request, struct in_addr ipaddr)
+authenticateAuthUserRequestSetIp(auth_user_request_t * auth_user_request, struct IN_ADDR ipaddr)
{
auth_user_ip_t *ipdata, *tempnode;
auth_user_t *auth_user;
void
-authenticateAuthUserRequestRemoveIp(auth_user_request_t * auth_user_request, struct in_addr ipaddr)
+authenticateAuthUserRequestRemoveIp(auth_user_request_t * auth_user_request, struct IN_ADDR ipaddr)
{
auth_user_ip_t *ipdata;
auth_user_t *auth_user;
*/
auth_acl_t
-AuthUserRequest::authenticate(auth_user_request_t ** auth_user_request, http_hdr_type headertype, HttpRequest * request, ConnStateData::Pointer conn, struct in_addr src_addr)
+AuthUserRequest::authenticate(auth_user_request_t ** auth_user_request, http_hdr_type headertype, HttpRequest * request, ConnStateData::Pointer conn, struct IN_ADDR src_addr)
{
const char *proxy_auth;
assert(headertype != 0);
auth_acl_t
-AuthUserRequest::tryToAuthenticateAndSetAuthUser(auth_user_request_t ** auth_user_request, http_hdr_type headertype, HttpRequest * request, ConnStateData::Pointer conn, struct in_addr src_addr)
+AuthUserRequest::tryToAuthenticateAndSetAuthUser(auth_user_request_t ** auth_user_request, http_hdr_type headertype, HttpRequest * request, ConnStateData::Pointer conn, struct IN_ADDR src_addr)
{
/* If we have already been called, return the cached value */
auth_user_request_t *t = authTryGetUser (auth_user_request, conn, request);
/*
- * $Id: AuthUserRequest.h,v 1.1 2004/08/30 03:28:56 robertc Exp $
+ * $Id: AuthUserRequest.h,v 1.2 2005/04/18 21:52:41 hno Exp $
*
* DO NOT MODIFY NEXT 2 LINES:
* arch-tag: 674533af-8b21-4641-b71a-74c4639072a0
dlink_node node;
/* IP addr this user authenticated from */
- struct in_addr ipaddr;
+ struct IN_ADDR ipaddr;
time_t ip_expiretime;
};
public:
- static auth_acl_t tryToAuthenticateAndSetAuthUser(auth_user_request_t **, http_hdr_type, HttpRequest *, ConnStateData::Pointer, struct in_addr);
+ static auth_acl_t tryToAuthenticateAndSetAuthUser(auth_user_request_t **, http_hdr_type, HttpRequest *, ConnStateData::Pointer, struct IN_ADDR);
static void addReplyAuthHeader(HttpReply * rep, auth_user_request_t * auth_user_request, HttpRequest * request, int accelerated, int internal);
AuthUserRequest();
private:
- static auth_acl_t authenticate(auth_user_request_t ** auth_user_request, http_hdr_type headertype, HttpRequest * request, ConnStateData::Pointer conn, struct in_addr src_addr);
+ static auth_acl_t authenticate(auth_user_request_t ** auth_user_request, http_hdr_type headertype, HttpRequest * request, ConnStateData::Pointer conn, struct IN_ADDR src_addr);
/* return a message on the 407 error pages */
char *message;
extern void authenticateFixHeader(HttpReply *, auth_user_request_t *, HttpRequest *, int, int);
extern void authenticateAddTrailer(HttpReply *, auth_user_request_t *, HttpRequest *, int);
-extern void authenticateAuthUserRequestRemoveIp(auth_user_request_t *, struct in_addr);
+extern void authenticateAuthUserRequestRemoveIp(auth_user_request_t *, struct IN_ADDR);
extern void authenticateAuthUserRequestClearIp(auth_user_request_t *);
extern size_t authenticateAuthUserRequestIPCount(auth_user_request_t *);
extern int authenticateDirection(auth_user_request_t *);
/*
- * $Id: CompositePoolNode.h,v 1.5 2003/08/04 22:14:40 robertc Exp $
+ * $Id: CompositePoolNode.h,v 1.6 2005/04/18 21:52:41 hno Exp $
*
* DEBUG: section 77 Delay Pools
* AUTHOR: Robert Collins <robertc@squid-cache.org>
public:
CompositeSelectionDetails() {}
- struct in_addr src_addr;
+ struct IN_ADDR src_addr;
AuthUserRequest *user;
String tag;
};
/*
- * $Id: ESI.cc,v 1.12 2004/12/21 17:28:28 robertc Exp $
+ * $Id: ESI.cc,v 1.13 2005/04/18 21:52:41 hno Exp $
*
* DEBUG: section 86 ESI processing
* AUTHOR: Robert Collins
/* don't touch incoming, it's a pointer into buffered anyway */
}
-extern ErrorState *clientBuildError (err_type, http_status, char const *, struct in_addr *, HttpRequest *);
+extern ErrorState *clientBuildError (err_type, http_status, char const *, struct IN_ADDR *, HttpRequest *);
/* This can ONLY be used before we have sent *any* data to the client */
/*
- * $Id: HttpRequest.cc,v 1.47 2004/08/30 05:12:31 robertc Exp $
+ * $Id: HttpRequest.cc,v 1.48 2005/04/18 21:52:41 hno Exp $
*
* DEBUG: section 73 HTTP Request
* AUTHOR: Duane Wessels
int max_forwards;
/* these in_addr's could probably be sockaddr_in's */
- struct in_addr client_addr;
+ struct IN_ADDR client_addr;
- struct in_addr my_addr;
+ struct IN_ADDR my_addr;
unsigned short my_port;
unsigned short client_port;
HttpHeader header;
/*
- * $Id: HttpRequest.h,v 1.10 2004/08/30 05:12:31 robertc Exp $
+ * $Id: HttpRequest.h,v 1.11 2005/04/18 21:52:41 hno Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
int max_forwards;
/* these in_addr's could probably be sockaddr_in's */
- struct in_addr client_addr;
+ struct IN_ADDR client_addr;
- struct in_addr my_addr;
+ struct IN_ADDR my_addr;
unsigned short my_port;
unsigned short client_port;
HttpHeader header;
/*
- * $Id: asn.cc,v 1.99 2004/08/30 05:12:31 robertc Exp $
+ * $Id: asn.cc,v 1.100 2005/04/18 21:52:42 hno Exp $
*
* DEBUG: section 53 AS Number handling
* AUTHOR: Duane Wessels, Kostas Anagnostakis
/* PUBLIC */
int
-asnMatchIp(List<int> *data, struct in_addr addr)
+asnMatchIp(List<int> *data, struct IN_ADDR addr)
{
unsigned long lh;
List<int> *q = NULL;
as_info *asinfo = NULL;
- struct in_addr in_a, in_m;
+ struct IN_ADDR in_a, in_m;
long mask, addr;
char *t;
int bitl;
List<int> *q;
as_info *asinfo;
- struct in_addr addr;
+ struct IN_ADDR addr;
- struct in_addr mask;
+ struct IN_ADDR mask;
assert(e);
assert(e->e_info);
(void) get_m_int(addr.s_addr, e->e_addr);
bool
-ACLASN::match(struct in_addr toMatch)
+ACLASN::match(struct IN_ADDR toMatch)
{
return asnMatchIp(data, toMatch);
}
}
}
-ACLData<struct in_addr> *
+ACLData<struct IN_ADDR> *
ACLASN::clone() const
{
if (data)
/* explicit template instantiation required for some systems */
-template class ACLStrategised<struct in_addr>
+template class ACLStrategised<struct IN_ADDR>
;
ACL::Prototype ACLASN::SourceRegistryProtoype(&ACLASN::SourceRegistryEntry_, "src_as");
-ACLStrategised<struct in_addr> ACLASN::SourceRegistryEntry_(new ACLASN, ACLSourceASNStrategy::Instance(), "src_as");
+ACLStrategised<struct IN_ADDR> ACLASN::SourceRegistryEntry_(new ACLASN, ACLSourceASNStrategy::Instance(), "src_as");
ACL::Prototype ACLASN::DestinationRegistryProtoype(&ACLASN::DestinationRegistryEntry_, "dst_as");
-ACLStrategised<struct in_addr> ACLASN::DestinationRegistryEntry_(new ACLASN, ACLDestinationASNStrategy::Instance(), "dst_as");
+ACLStrategised<struct IN_ADDR> ACLASN::DestinationRegistryEntry_(new ACLASN, ACLDestinationASNStrategy::Instance(), "dst_as");
int
ACLSourceASNStrategy::match (ACLData<MatchType> * &data, ACLChecklist *checklist)
/*
- * $Id: auth_digest.cc,v 1.41 2004/12/24 01:03:39 hno Exp $
+ * $Id: auth_digest.cc,v 1.42 2005/04/18 21:52:43 hno Exp $
*
* DEBUG: section 29 Authenticator
* AUTHOR: Robert Collins
} else {
const char *useragent = httpHeaderGetStr(&request->header, HDR_USER_AGENT);
- static struct in_addr last_broken_addr;
+ static struct IN_ADDR last_broken_addr;
static int seen_broken_client = 0;
if (!seen_broken_client) {
/*
- * $Id: cache_cf.cc,v 1.468 2005/03/18 17:12:34 hno Exp $
+ * $Id: cache_cf.cc,v 1.469 2005/04/18 21:52:42 hno Exp $
*
* DEBUG: section 3 Configuration File Parsing
* AUTHOR: Harvest Derived
static void
-dump_address(StoreEntry * entry, const char *name, struct in_addr addr)
+dump_address(StoreEntry * entry, const char *name, struct IN_ADDR addr)
{
storeAppendPrintf(entry, "%s %s\n", name, inet_ntoa(addr));
}
static void
-parse_address(struct in_addr *addr)
+parse_address(struct IN_ADDR *addr)
{
const struct hostent *hp;
static void
-free_address(struct in_addr *addr)
+free_address(struct IN_ADDR *addr)
{
- memset(addr, '\0', sizeof(struct in_addr));
+ memset(addr, '\0', sizeof(struct IN_ADDR));
}
CBDATA_TYPE(acl_address);
/*
- * $Id: cachemgr.cc,v 1.107 2004/12/21 17:28:29 robertc Exp $
+ * $Id: cachemgr.cc,v 1.108 2005/04/18 21:52:42 hno Exp $
*
* DEBUG: section 0 CGI Cache Manager
* AUTHOR: Duane Wessels
static const char *progname = NULL;
static time_t now;
-static struct in_addr no_addr;
+static struct IN_ADDR no_addr;
/*
* Function prototypes
/*
- * $Id: client_db.cc,v 1.62 2004/12/22 17:37:37 serassio Exp $
+ * $Id: client_db.cc,v 1.63 2005/04/18 21:52:42 hno Exp $
*
* DEBUG: section 0 Client Database
* AUTHOR: Duane Wessels
static hash_table *client_table = NULL;
-static ClientInfo *clientdbAdd(struct in_addr addr);
+static ClientInfo *clientdbAdd(struct IN_ADDR addr);
static FREE clientdbFreeItem;
static void clientdbStartGC(void);
static void clientdbScheduledGC(void *);
static ClientInfo *
-clientdbAdd(struct in_addr addr)
+clientdbAdd(struct IN_ADDR addr)
{
ClientInfo *c;
c = (ClientInfo *)memAllocate(MEM_CLIENT_INFO);
void
-clientdbUpdate(struct in_addr addr, log_type ltype, protocol_t p, size_t size)
+clientdbUpdate(struct IN_ADDR addr, log_type ltype, protocol_t p, size_t size)
{
char *key;
ClientInfo *c;
*/
int
-clientdbEstablished(struct in_addr addr, int delta)
+clientdbEstablished(struct IN_ADDR addr, int delta)
{
char *key;
ClientInfo *c;
#define CUTOFF_SECONDS 3600
int
-clientdbCutoffDenied(struct in_addr addr)
+clientdbCutoffDenied(struct IN_ADDR addr)
{
char *key;
int NR;
#if SQUID_SNMP
-struct in_addr *
+struct IN_ADDR *
- client_entry(struct in_addr *current)
+ client_entry(struct IN_ADDR *current)
{
ClientInfo *c = NULL;
char *key;
/*
- * $Id: client_side.h,v 1.9 2003/08/14 12:15:04 robertc Exp $
+ * $Id: client_side.h,v 1.10 2005/04/18 21:52:42 hno Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
struct sockaddr_in me;
- struct in_addr log_addr;
+ struct IN_ADDR log_addr;
char rfc931[USER_IDENT_SZ];
int nrequests;
/*
- * $Id: client_side_reply.cc,v 1.82 2005/03/09 20:43:38 serassio Exp $
+ * $Id: client_side_reply.cc,v 1.83 2005/04/18 21:52:42 hno Exp $
*
* DEBUG: section 88 Client-side Reply Routines
* AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c)
extern "C" CSS clientReplyStatus;
extern ErrorState *clientBuildError(err_type, http_status, char const *,
- struct in_addr *, HttpRequest *);
+ struct IN_ADDR *, HttpRequest *);
/* privates */
clientReplyContext::setReplyToError(
err_type err, http_status status, method_t method, char const *uri,
- struct in_addr *addr, HttpRequest * failedrequest, char *unparsedrequest,
+ struct IN_ADDR *addr, HttpRequest * failedrequest, char *unparsedrequest,
auth_user_request_t * auth_user_request)
{
ErrorState *errstate =
ErrorState *
clientBuildError(err_type page_id, http_status status, char const *url,
- struct in_addr * src_addr, HttpRequest * request)
+ struct IN_ADDR * src_addr, HttpRequest * request)
{
ErrorState *err = errorCon(page_id, status);
err->src_addr = *src_addr;
/*
- * $Id: client_side_reply.h,v 1.6 2003/08/10 11:00:42 robertc Exp $
+ * $Id: client_side_reply.h,v 1.7 2005/04/18 21:52:42 hno Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
int storeOKTransferDone() const;
int storeNotOKTransferDone() const;
- void setReplyToError(err_type, http_status, method_t, char const *, struct in_addr *, HttpRequest *, char *, auth_user_request_t *);
+ void setReplyToError(err_type, http_status, method_t, char const *, struct IN_ADDR *, HttpRequest *, char *, auth_user_request_t *);
void createStoreEntry(method_t m, request_flags flags);
void removeStoreReference(store_client ** scp, StoreEntry ** ep);
void removeClientStoreReference(store_client **scp, ClientHttpRequest *http);
/*
- * $Id: comm.cc,v 1.403 2005/04/06 19:01:01 serassio Exp $
+ * $Id: comm.cc,v 1.404 2005/04/18 21:52:42 hno Exp $
*
* DEBUG: section 5 Socket Functions
* AUTHOR: Harvest Derived
struct sockaddr_in S;
CallBack<CNCB> callback;
- struct in_addr in_addr;
+ struct IN_ADDR in_addr;
int fd;
int tries;
int addrcount;
/* STATIC */
-static comm_err_t commBind(int s, struct in_addr, u_short port);
+static comm_err_t commBind(int s, struct IN_ADDR, u_short port);
static void commSetReuseAddr(int);
static void commSetNoLinger(int);
static void CommWriteStateCallbackAndFree(int fd, comm_err_t code);
static comm_err_t
-commBind(int s, struct in_addr in_addr, u_short port)
+commBind(int s, struct IN_ADDR in_addr, u_short port)
{
struct sockaddr_in S;
comm_open(int sock_type,
int proto,
- struct in_addr addr,
+ struct IN_ADDR addr,
u_short port,
int flags,
const char *note)
comm_openex(int sock_type,
int proto,
- struct in_addr addr,
+ struct IN_ADDR addr,
u_short port,
int flags,
unsigned char TOS,
/*
- * $Id: delay_pools.cc,v 1.42 2003/08/04 22:14:42 robertc Exp $
+ * $Id: delay_pools.cc,v 1.43 2005/04/18 21:52:42 hno Exp $
*
* DEBUG: section 77 Delay Pools
* AUTHOR: Robert Collins <robertc@squid-cache.org>
virtual char const *label() const = 0;
- virtual unsigned int const makeKey (struct in_addr &src_addr) const = 0;
+ virtual unsigned int const makeKey (struct IN_ADDR &src_addr) const = 0;
DelaySpec spec;
protected:
virtual char const *label() const {return "Individual";}
- virtual unsigned int const makeKey (struct in_addr &src_addr) const;
+ virtual unsigned int const makeKey (struct IN_ADDR &src_addr) const;
};
protected:
virtual char const *label() const {return "Network";}
- virtual unsigned int const makeKey (struct in_addr &src_addr) const;
+ virtual unsigned int const makeKey (struct IN_ADDR &src_addr) const;
};
/* don't use remote storage for these */
virtual char const *label() const {return "Individual";}
- virtual unsigned int const makeKey (struct in_addr &src_addr) const;
+ virtual unsigned int const makeKey (struct IN_ADDR &src_addr) const;
- unsigned char const makeHostKey (struct in_addr &src_addr) const;
+ unsigned char const makeHostKey (struct IN_ADDR &src_addr) const;
DelaySpec spec;
VectorMap<unsigned char, ClassCBucket> buckets;
unsigned int const
-IndividualPool::makeKey (struct in_addr &src_addr) const
+IndividualPool::makeKey (struct IN_ADDR &src_addr) const
{
unsigned int host;
host = ntohl(src_addr.s_addr) & 0xff;
unsigned int const
-ClassCNetPool::makeKey (struct in_addr &src_addr) const
+ClassCNetPool::makeKey (struct IN_ADDR &src_addr) const
{
unsigned int net;
net = (ntohl(src_addr.s_addr) >> 8) & 0xff;
unsigned char const
-ClassCHostPool::makeHostKey (struct in_addr &src_addr) const
+ClassCHostPool::makeHostKey (struct IN_ADDR &src_addr) const
{
unsigned int host;
host = ntohl(src_addr.s_addr) & 0xff;
unsigned int const
-ClassCHostPool::makeKey (struct in_addr &src_addr) const
+ClassCHostPool::makeKey (struct IN_ADDR &src_addr) const
{
unsigned int net;
net = (ntohl(src_addr.s_addr) >> 8) & 0xff;
/*
- * $Id: dns_internal.cc,v 1.66 2004/12/20 16:30:35 robertc Exp $
+ * $Id: dns_internal.cc,v 1.67 2005/04/18 21:52:42 hno Exp $
*
* DEBUG: section 78 DNS lookups; interacts with lib/rfc1035.c
* AUTHOR: Duane Wessels
idnsAddNameserver(const char *buf)
{
- struct in_addr A;
+ struct IN_ADDR A;
if (!safe_inet_addr(buf, &A)) {
debug(78, 0) ("WARNING: rejecting '%s' as a name server, because it is not a numeric IP address\n", buf);
if (DnsSocket < 0) {
int port;
- struct in_addr addr;
+ struct IN_ADDR addr;
if (Config.Addrs.udp_outgoing.s_addr != no_addr.s_addr)
addr = Config.Addrs.udp_outgoing;
void
-idnsPTRLookup(const struct in_addr addr, IDNSCB * callback, void *data)
+idnsPTRLookup(const struct IN_ADDR addr, IDNSCB * callback, void *data)
{
idns_query *q;
/*
- * $Id: dnsserver.cc,v 1.69 2004/12/21 17:28:29 robertc Exp $
+ * $Id: dnsserver.cc,v 1.70 2005/04/18 21:52:42 hno Exp $
*
* DEBUG: section 0 DNS Resolver
* AUTHOR: Harvest Derived
#define gethostbyname _res_gethostbyname
#endif /* _SQUID_NEXT_ */
-static struct in_addr no_addr;
+static struct IN_ADDR no_addr;
#ifdef _SQUID_OS2_
int retry = 0;
int i;
- struct in_addr addr;
+ struct IN_ADDR addr;
if (0 == strcmp(buf, "$shutdown"))
exit(0);
/*
- * $Id: fde.h,v 1.7 2005/03/18 15:17:17 hno Exp $
+ * $Id: fde.h,v 1.8 2005/04/18 21:52:42 hno Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
u_short local_port;
u_short remote_port;
- struct in_addr local_addr;
+ struct IN_ADDR local_addr;
unsigned char tos;
char ipaddr[16]; /* dotted decimal address of peer */
char desc[FD_DESC_SZ];
/*
- * $Id: forward.cc,v 1.126 2005/03/18 15:22:05 hno Exp $
+ * $Id: forward.cc,v 1.127 2005/04/18 21:52:42 hno Exp $
*
* DEBUG: section 17 Request Forwarding
* AUTHOR: Duane Wessels
comm_close(fd);
}
-static struct in_addr
+static struct IN_ADDR
aclMapAddr(acl_address * head, ACLChecklist * ch)
{
acl_address *l;
- struct in_addr addr;
+ struct IN_ADDR addr;
for (l = head; l; l = l->next)
{
return 0;
}
-struct in_addr
+struct IN_ADDR
getOutgoingAddr(HttpRequest * request)
{
ACLChecklist ch;
int ctimeout;
int ftimeout = Config.Timeout.forward - (squid_curtime - fwdState->start);
- struct in_addr outgoing;
+ struct IN_ADDR outgoing;
unsigned short tos;
assert(fs);
assert(fwdState->server_fd == -1);
/*
- * $Id: fqdncache.cc,v 1.163 2005/02/13 15:49:50 serassio Exp $
+ * $Id: fqdncache.cc,v 1.164 2005/04/18 21:52:42 hno Exp $
*
* DEBUG: section 35 FQDN Cache
* AUTHOR: Harvest Derived
void
-fqdncache_nbgethostbyaddr(struct in_addr addr, FQDNH * handler, void *handlerData)
+fqdncache_nbgethostbyaddr(struct IN_ADDR addr, FQDNH * handler, void *handlerData)
{
fqdncache_entry *f = NULL;
char *name = inet_ntoa(addr);
const char *
-fqdncache_gethostbyaddr(struct in_addr addr, int flags)
+fqdncache_gethostbyaddr(struct IN_ADDR addr, int flags)
{
char *name = inet_ntoa(addr);
fqdncache_entry *f = NULL;
- struct in_addr ip;
+ struct IN_ADDR ip;
assert(name);
FqdncacheStats.requests++;
f = fqdncache_get(name);
const char *
-fqdnFromAddr(struct in_addr addr)
+fqdnFromAddr(struct IN_ADDR addr)
{
const char *n;
static char buf[32];
/*
- * $Id: globals.h,v 1.129 2005/03/18 15:47:41 hno Exp $
+ * $Id: globals.h,v 1.130 2005/04/18 21:52:42 hno Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
extern struct _acl_deny_info_list *DenyInfoList; /* NULL */
-extern struct in_addr any_addr;
+extern struct IN_ADDR any_addr;
-extern struct in_addr local_addr;
+extern struct IN_ADDR local_addr;
-extern struct in_addr no_addr;
+extern struct IN_ADDR no_addr;
-extern struct in_addr theOutICPAddr;
+extern struct IN_ADDR theOutICPAddr;
-extern struct in_addr theOutSNMPAddr;
+extern struct IN_ADDR theOutSNMPAddr;
extern struct timeval current_time;
/*
- * $Id: icmp.cc,v 1.84 2003/06/12 23:54:17 wessels Exp $
+ * $Id: icmp.cc,v 1.85 2005/04/18 21:52:42 hno Exp $
*
* DEBUG: section 37 ICMP Routines
* AUTHOR: Duane Wessels
static void
-icmpSendEcho(struct in_addr to, int opcode, const char *payload, int len)
+icmpSendEcho(struct IN_ADDR to, int opcode, const char *payload, int len)
{
static pingerEchoData pecho;
#if ALLOW_SOURCE_PING
void
-icmpSourcePing(struct in_addr to, const icp_common_t * header, const char *url)
+icmpSourcePing(struct IN_ADDR to, const icp_common_t * header, const char *url)
{
#if USE_ICMP
char *payload;
void
-icmpDomainPing(struct in_addr to, const char *domain)
+icmpDomainPing(struct IN_ADDR to, const char *domain)
{
#if USE_ICMP
debug(37, 3) ("icmpDomainPing: '%s'\n", domain);
/*
- * $Id: icp_v2.cc,v 1.84 2003/09/21 00:30:47 robertc Exp $
+ * $Id: icp_v2.cc,v 1.85 2005/04/18 21:52:42 hno Exp $
*
* DEBUG: section 12 Internet Cache Protocol
* AUTHOR: Duane Wessels
#include "ACL.h"
#include "AccessLogEntry.h"
-static void icpLogIcp(struct in_addr, log_type, int, const char *, int);
+static void icpLogIcp(struct IN_ADDR, log_type, int, const char *, int);
static void icpHandleIcpV2(int, struct sockaddr_in, char *, int);
static void icpCount(void *, int, size_t, int);
static void
-icpLogIcp(struct in_addr caddr, log_type logcode, int len, const char *url, int delay)
+icpLogIcp(struct IN_ADDR caddr, log_type logcode, int len, const char *url, int delay)
{
AccessLogEntry al;
icpPktDump(icp_common_t * pkt)
{
- struct in_addr a;
+ struct IN_ADDR a;
debug(12, 9) ("opcode: %3d %s\n",
(int) pkt->opcode,
{
u_int16_t port;
- struct in_addr addr;
+ struct IN_ADDR addr;
struct sockaddr_in xaddr;
int x;
theOutIcpConnection = theInIcpConnection;
}
- memset(&theOutICPAddr, '\0', sizeof(struct in_addr));
+ memset(&theOutICPAddr, '\0', sizeof(struct IN_ADDR));
len = sizeof(struct sockaddr_in);
memset(&xaddr, '\0', len);
/*
- * $Id: ipcache.cc,v 1.250 2005/02/13 15:49:50 serassio Exp $
+ * $Id: ipcache.cc,v 1.251 2005/04/18 21:52:42 hno Exp $
*
* DEBUG: section 14 IP Cache
* AUTHOR: Harvest Derived
if (ipcount > 0) {
int j, k;
- i->addrs.in_addrs = (struct in_addr *)xcalloc(ipcount, sizeof(struct in_addr));
+ i->addrs.in_addrs = (struct IN_ADDR *)xcalloc(ipcount, sizeof(struct IN_ADDR));
i->addrs.bad_mask = (unsigned char *)xcalloc(ipcount, sizeof(unsigned char));
for (j = 0, k = 0; k < ipcount; k++) {
return 0;
}
- i->addrs.in_addrs = (struct in_addr *)xcalloc(na, sizeof(struct in_addr));
+ i->addrs.in_addrs = (struct IN_ADDR *)xcalloc(na, sizeof(struct IN_ADDR));
i->addrs.bad_mask = (unsigned char *)xcalloc(na, sizeof(unsigned char));
for (j = 0, k = 0; k < nr; k++) {
memset(&static_addrs, '\0', sizeof(ipcache_addrs));
- static_addrs.in_addrs = (struct in_addr *)xcalloc(1, sizeof(struct in_addr));
+ static_addrs.in_addrs = (struct IN_ADDR *)xcalloc(1, sizeof(struct IN_ADDR));
static_addrs.bad_mask = (unsigned char *)xcalloc(1, sizeof(unsigned char));
ipcache_high = (long) (((float) Config.ipcache.size *
(float) Config.ipcache.high) / (float) 100);
ipcacheCheckNumeric(const char *name)
{
- struct in_addr ip;
+ struct IN_ADDR ip;
/* check if it's already a IP address in text form. */
if (!safe_inet_addr(name, &ip))
*/
void
-ipcacheMarkBadAddr(const char *name, struct in_addr addr)
+ipcacheMarkBadAddr(const char *name, struct IN_ADDR addr)
{
ipcache_entry *i;
ipcache_addrs *ia;
void
-ipcacheMarkGoodAddr(const char *name, struct in_addr addr)
+ipcacheMarkGoodAddr(const char *name, struct IN_ADDR addr)
{
ipcache_entry *i;
ipcache_addrs *ia;
{
ipcache_entry *i;
- struct in_addr ip;
+ struct IN_ADDR ip;
if (!safe_inet_addr(ipaddr, &ip)) {
if (strchr(ipaddr, ':') && strspn(ipaddr, "0123456789abcdefABCDEF:") == strlen(ipaddr)) {
i->addrs.cur = 0;
i->addrs.badcount = 0;
- i->addrs.in_addrs = (struct in_addr *)xcalloc(1, sizeof(struct in_addr));
+ i->addrs.in_addrs = (struct IN_ADDR *)xcalloc(1, sizeof(struct IN_ADDR));
i->addrs.bad_mask = (unsigned char *)xcalloc(1, sizeof(unsigned char));
i->addrs.in_addrs[0].s_addr = ip.s_addr;
i->addrs.bad_mask[0] = FALSE;
/*
- * $Id: main.cc,v 1.407 2005/04/06 18:44:25 serassio Exp $
+ * $Id: main.cc,v 1.408 2005/04/18 21:52:42 hno Exp $
*
* DEBUG: section 1 Startup and Main Loop
* AUTHOR: Harvest Derived
if (oldmask)
umask(oldmask);
- memset(&local_addr, '\0', sizeof(struct in_addr));
+ memset(&local_addr, '\0', sizeof(struct IN_ADDR));
safe_inet_addr(localhost, &local_addr);
- memset(&any_addr, '\0', sizeof(struct in_addr));
+ memset(&any_addr, '\0', sizeof(struct IN_ADDR));
safe_inet_addr("0.0.0.0", &any_addr);
- memset(&no_addr, '\0', sizeof(struct in_addr));
+ memset(&no_addr, '\0', sizeof(struct IN_ADDR));
safe_inet_addr("255.255.255.255", &no_addr);
/*
- * $Id: neighbors.cc,v 1.329 2005/03/10 20:22:46 serassio Exp $
+ * $Id: neighbors.cc,v 1.330 2005/04/18 21:52:42 hno Exp $
*
* DEBUG: section 15 Neighbor Routines
* AUTHOR: Harvest Derived
int j;
u_short port = ntohs(from->sin_port);
- struct in_addr ip = from->sin_addr;
+ struct IN_ADDR ip = from->sin_addr;
peer *p = NULL;
debug(15, 3) ("whichPeer: from %s port %d\n", inet_ntoa(ip), port);
/*
- * $Id: net_db.cc,v 1.175 2005/01/05 21:59:34 serassio Exp $
+ * $Id: net_db.cc,v 1.176 2005/04/18 21:52:42 hno Exp $
*
* DEBUG: section 38 Network Measurement Database
* AUTHOR: Duane Wessels
static hash_table *addr_table = NULL;
static hash_table *host_table = NULL;
-static struct in_addr networkFromInaddr(struct in_addr a);
+static struct IN_ADDR networkFromInaddr(struct IN_ADDR a);
static void netdbRelease(netdbEntry * n);
-static void netdbHashInsert(netdbEntry * n, struct in_addr addr);
+static void netdbHashInsert(netdbEntry * n, struct IN_ADDR addr);
static void netdbHashDelete(const char *key);
static void netdbHostInsert(netdbEntry * n, const char *hostname);
static void netdbHostDelete(const net_db_name * x);
static void
-netdbHashInsert(netdbEntry * n, struct in_addr addr)
+netdbHashInsert(netdbEntry * n, struct IN_ADDR addr)
{
xstrncpy(n->network, inet_ntoa(networkFromInaddr(addr)), 16);
n->hash.key = n->network;
static netdbEntry *
-netdbLookupAddr(struct in_addr addr)
+netdbLookupAddr(struct IN_ADDR addr)
{
netdbEntry *n;
char *key = inet_ntoa(networkFromInaddr(addr));
static netdbEntry *
-netdbAdd(struct in_addr addr)
+netdbAdd(struct IN_ADDR addr)
{
netdbEntry *n;
netdbSendPing(const ipcache_addrs * ia, void *data)
{
- struct in_addr addr;
+ struct IN_ADDR addr;
char *hostname = (char *)((generic_cbdata *) data)->data;
netdbEntry *n;
netdbEntry *na;
xfree(hostname);
}
-static struct in_addr
+static struct IN_ADDR
- networkFromInaddr(struct in_addr a)
+ networkFromInaddr(struct IN_ADDR a)
{
- struct in_addr b;
+ struct IN_ADDR b;
b.s_addr = ntohl(a.s_addr);
#if USE_CLASSFUL
netdbEntry *n;
netdbEntry N;
- struct in_addr addr;
+ struct IN_ADDR addr;
int count = 0;
struct timeval start = current_time;
int rec_sz = 0;
off_t o;
- struct in_addr addr;
+ struct IN_ADDR addr;
double rtt;
double hops;
char *p;
int
-netdbHops(struct in_addr addr)
+netdbHops(struct IN_ADDR addr)
{
#if USE_ICMP
netdbEntry *n = netdbLookupAddr(addr);
void
-netdbExchangeUpdatePeer(struct in_addr addr, peer * e, double rtt, double hops)
+netdbExchangeUpdatePeer(struct IN_ADDR addr, peer * e, double rtt, double hops)
{
#if USE_ICMP
netdbEntry *n;
void
-netdbDeleteAddrNetwork(struct in_addr addr)
+netdbDeleteAddrNetwork(struct IN_ADDR addr)
{
#if USE_ICMP
netdbEntry *n = netdbLookupAddr(addr);
int rec_sz;
char *buf;
- struct in_addr addr;
+ struct IN_ADDR addr;
storeBuffer(s);
HttpVersion version(1, 0);
httpReplySetHeaders(reply, version, HTTP_OK, "OK",
/*
- * $Id: pinger.cc,v 1.53 2004/04/03 14:38:36 hno Exp $
+ * $Id: pinger.cc,v 1.54 2005/04/18 21:52:42 hno Exp $
*
* DEBUG: section 42 ICMP Pinger program
* AUTHOR: Duane Wessels
static int in_cksum(unsigned short *ptr, int size);
static void pingerRecv(void);
-static void pingerLog(struct icmphdr *, struct in_addr, int, int);
+static void pingerLog(struct icmphdr *, struct IN_ADDR, int, int);
static int ipHops(int ttl);
static void pingerSendtoSquid(pingerReplyData * preply);
static void pingerOpen(void);
static void
-pingerSendEcho(struct in_addr to, int opcode, char *payload, int len)
+pingerSendEcho(struct IN_ADDR to, int opcode, char *payload, int len)
{
LOCAL_ARRAY(char, pkt, MAX_PKT_SZ);
static void
-pingerLog(struct icmphdr *icmp, struct in_addr addr, int rtt, int hops)
+pingerLog(struct icmphdr *icmp, struct IN_ADDR addr, int rtt, int hops)
{
debug(42, 2) ("pingerLog: %9d.%06d %-16s %d %-15.15s %dms %d hops\n",
(int) current_time.tv_sec,
/*
- * $Id: protos.h,v 1.504 2005/04/06 18:44:25 serassio Exp $
+ * $Id: protos.h,v 1.505 2005/04/18 21:52:43 hno Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
SQUIDCEXTERN void clientdbInit(void);
-SQUIDCEXTERN void clientdbUpdate(struct in_addr, log_type, protocol_t, size_t);
+SQUIDCEXTERN void clientdbUpdate(struct IN_ADDR, log_type, protocol_t, size_t);
-SQUIDCEXTERN int clientdbCutoffDenied(struct in_addr);
+SQUIDCEXTERN int clientdbCutoffDenied(struct IN_ADDR);
SQUIDCEXTERN void clientdbDump(StoreEntry *);
SQUIDCEXTERN void clientdbFreeMemory(void);
-SQUIDCEXTERN int clientdbEstablished(struct in_addr, int);
+SQUIDCEXTERN int clientdbEstablished(struct IN_ADDR, int);
SQUIDCEXTERN void clientOpenListenSockets(void);
SQUIDCEXTERN void clientHttpConnectionsClose(void);
SQUIDCEXTERN void clientReadBody(HttpRequest * req, char *buf, size_t size, CBCB * callback, void *data);
SQUIDCEXTERN int comm_connect_addr(int sock, const struct sockaddr_in *);
SQUIDCEXTERN void comm_init(void);
-SQUIDCEXTERN int comm_open(int, int, struct in_addr, u_short port, int, const char *note);
+SQUIDCEXTERN int comm_open(int, int, struct IN_ADDR, u_short port, int, const char *note);
-SQUIDCEXTERN int comm_openex(int, int, struct in_addr, u_short, int, unsigned char TOS, const char *);
+SQUIDCEXTERN int comm_openex(int, int, struct IN_ADDR, u_short, int, unsigned char TOS, const char *);
SQUIDCEXTERN u_short comm_local_port(int fd);
SQUIDCEXTERN void commSetSelect(int, unsigned int, PF *, void *, time_t);
SQUIDCEXTERN void idnsShutdown(void);
SQUIDCEXTERN void idnsALookup(const char *, IDNSCB *, void *);
-SQUIDCEXTERN void idnsPTRLookup(const struct in_addr, IDNSCB *, void *);
+SQUIDCEXTERN void idnsPTRLookup(const struct IN_ADDR, IDNSCB *, void *);
extern void eventAdd(const char *name, EVH * func, void *arg, double when, int, bool cbdata=true);
SQUIDCEXTERN void eventAddIsh(const char *name, EVH * func, void *arg, double delta_ish, int);
SQUIDCEXTERN void filemapFreeMemory(fileMap *);
-SQUIDCEXTERN void fqdncache_nbgethostbyaddr(struct in_addr, FQDNH *, void *);
+SQUIDCEXTERN void fqdncache_nbgethostbyaddr(struct IN_ADDR, FQDNH *, void *);
-SQUIDCEXTERN const char *fqdncache_gethostbyaddr(struct in_addr, int flags);
+SQUIDCEXTERN const char *fqdncache_gethostbyaddr(struct IN_ADDR, int flags);
SQUIDCEXTERN void fqdncache_init(void);
SQUIDCEXTERN void fqdnStats(StoreEntry *);
SQUIDCEXTERN void fqdncacheReleaseInvalid(const char *);
-SQUIDCEXTERN const char *fqdnFromAddr(struct in_addr);
+SQUIDCEXTERN const char *fqdnFromAddr(struct IN_ADDR);
SQUIDCEXTERN int fqdncacheQueueDrain(void);
SQUIDCEXTERN void fqdncacheFreeMemory(void);
SQUIDCEXTERN void fqdncache_restart(void);
SQUIDCEXTERN void icmpOpen(void);
SQUIDCEXTERN void icmpClose(void);
-SQUIDCEXTERN void icmpSourcePing(struct in_addr to, const icp_common_t *, const char *url);
+SQUIDCEXTERN void icmpSourcePing(struct IN_ADDR to, const icp_common_t *, const char *url);
-SQUIDCEXTERN void icmpDomainPing(struct in_addr to, const char *domain);
+SQUIDCEXTERN void icmpDomainPing(struct IN_ADDR to, const char *domain);
#ifdef SQUID_SNMP
SQUIDCEXTERN PF snmpHandleUdp;
SQUIDCEXTERN void snmpConnectionClose(void);
SQUIDCEXTERN void snmpDebugOid(int lvl, oid * Name, snint Len);
-SQUIDCEXTERN void addr2oid(struct in_addr addr, oid * Dest);
+SQUIDCEXTERN void addr2oid(struct IN_ADDR addr, oid * Dest);
-SQUIDCEXTERN struct in_addr *oid2addr(oid * id);
+SQUIDCEXTERN struct IN_ADDR *oid2addr(oid * id);
-SQUIDCEXTERN struct in_addr *client_entry(struct in_addr *current);
+SQUIDCEXTERN struct IN_ADDR *client_entry(struct IN_ADDR *current);
SQUIDCEXTERN variable_list *snmp_basicFn(variable_list *, snint *);
SQUIDCEXTERN variable_list *snmp_confFn(variable_list *, snint *);
SQUIDCEXTERN variable_list *snmp_sysFn(variable_list *, snint *);
SQUIDCEXTERN void stat_ipcache_get(StoreEntry *);
SQUIDCEXTERN void ipcacheCycleAddr(const char *name, ipcache_addrs *);
-SQUIDCEXTERN void ipcacheMarkBadAddr(const char *name, struct in_addr);
+SQUIDCEXTERN void ipcacheMarkBadAddr(const char *name, struct IN_ADDR);
-SQUIDCEXTERN void ipcacheMarkGoodAddr(const char *name, struct in_addr);
+SQUIDCEXTERN void ipcacheMarkGoodAddr(const char *name, struct IN_ADDR);
SQUIDCEXTERN void ipcacheFreeMemory(void);
SQUIDCEXTERN ipcache_addrs *ipcacheCheckNumeric(const char *name);
SQUIDCEXTERN void ipcache_restart(void);
SQUIDCEXTERN void netdbPingSite(const char *hostname);
SQUIDCEXTERN void netdbDump(StoreEntry *);
-SQUIDCEXTERN int netdbHops(struct in_addr);
+SQUIDCEXTERN int netdbHops(struct IN_ADDR);
SQUIDCEXTERN void netdbFreeMemory(void);
SQUIDCEXTERN int netdbHostHops(const char *host);
SQUIDCEXTERN int netdbHostRtt(const char *host);
SQUIDCEXTERN void netdbUpdatePeer(HttpRequest *, peer * e, int rtt, int hops);
-SQUIDCEXTERN void netdbDeleteAddrNetwork(struct in_addr addr);
+SQUIDCEXTERN void netdbDeleteAddrNetwork(struct IN_ADDR addr);
SQUIDCEXTERN void netdbBinaryExchange(StoreEntry *);
SQUIDCEXTERN EVH netdbExchangeStart;
-SQUIDCEXTERN void netdbExchangeUpdatePeer(struct in_addr, peer *, double, double);
+SQUIDCEXTERN void netdbExchangeUpdatePeer(struct IN_ADDR, peer *, double, double);
SQUIDCEXTERN peer *netdbClosestParent(HttpRequest *);
SQUIDCEXTERN void netdbHostData(const char *host, int *samp, int *rtt, int *hops);
SQUIDCEXTERN void fwdStatus(FwdState *, http_status);
#endif
-SQUIDCEXTERN struct in_addr getOutgoingAddr(HttpRequest * request);
+SQUIDCEXTERN struct IN_ADDR getOutgoingAddr(HttpRequest * request);
unsigned long getOutgoingTOS(HttpRequest * request);
SQUIDCEXTERN void urnStart(HttpRequest *, StoreEntry *);
SQUIDCEXTERN void squid_signal(int sig, SIGHDLR *, int flags);
SQUIDCEXTERN pid_t readPidFile(void);
-SQUIDCEXTERN struct in_addr inaddrFromHostent(const struct hostent *hp);
+SQUIDCEXTERN struct IN_ADDR inaddrFromHostent(const struct hostent *hp);
SQUIDCEXTERN int intAverage(int, int, int, int);
SQUIDCEXTERN double doubleAverage(double, double, int, int);
SQUIDCEXTERN void debug_trap(const char *);
/*
- * $Id: redirect.cc,v 1.109 2004/12/20 16:30:36 robertc Exp $
+ * $Id: redirect.cc,v 1.110 2005/04/18 21:52:43 hno Exp $
*
* DEBUG: section 61 Redirector
* AUTHOR: Duane Wessels
void *data;
char *orig_url;
- struct in_addr client_addr;
+ struct IN_ADDR client_addr;
const char *client_ident;
const char *method_s;
RH *handler;
/*
- * $Id: snmp_agent.cc,v 1.90 2005/01/03 16:08:26 robertc Exp $
+ * $Id: snmp_agent.cc,v 1.91 2005/04/18 21:52:43 hno Exp $
*
* DEBUG: section 49 SNMP Interface
* AUTHOR: Kostas Anagnostakis
{
variable_list *Answer = NULL;
- struct in_addr *laddr;
+ struct IN_ADDR *laddr;
char *cp = NULL;
peer *p = NULL;
int cnt = 0;
/*
- * $Id: snmp_core.cc,v 1.65 2003/09/21 00:30:47 robertc Exp $
+ * $Id: snmp_core.cc,v 1.66 2005/04/18 21:52:43 hno Exp $
*
* DEBUG: section 49 SNMP support
* AUTHOR: Glenn Chisholm
theOutSnmpConnection = theInSnmpConnection;
}
- memset(&theOutSNMPAddr, '\0', sizeof(struct in_addr));
+ memset(&theOutSNMPAddr, '\0', sizeof(struct IN_ADDR));
len = sizeof(struct sockaddr_in);
memset(&xaddr, '\0', len);
u_char *cp = NULL;
peer *peers = Config.peers;
- struct in_addr *laddr = NULL;
+ struct IN_ADDR *laddr = NULL;
char *host_addr = NULL, *current_addr = NULL, *last_addr = NULL;
if (peers == NULL) {
oid *instance = NULL;
u_char *cp = NULL;
- struct in_addr *laddr = NULL;
+ struct IN_ADDR *laddr = NULL;
if (*len <= current->len) {
instance = (oid *)xmalloc(sizeof(name) * (*len + 4));
void
-addr2oid(struct in_addr addr, oid * Dest)
+addr2oid(struct IN_ADDR addr, oid * Dest)
{
u_char *cp;
cp = (u_char *) & (addr.s_addr);
Dest[3] = *cp++;
}
-struct in_addr
+struct IN_ADDR
*
oid2addr(oid * id)
{
- static struct in_addr laddr;
+ static struct IN_ADDR laddr;
u_char *cp = (u_char *) & (laddr.s_addr);
cp[0] = id[0];
cp[1] = id[1];
/*
- * $Id: structs.h,v 1.515 2005/04/03 18:53:24 serassio Exp $
+ * $Id: structs.h,v 1.516 2005/04/18 21:52:43 hno Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
acl_address *next;
acl_list *aclList;
- struct in_addr addr;
+ struct IN_ADDR addr;
};
struct _acl_tos
struct
{
- struct in_addr router;
+ struct IN_ADDR router;
- struct in_addr incoming;
+ struct IN_ADDR incoming;
- struct in_addr outgoing;
+ struct IN_ADDR outgoing;
int version;
}
struct
{
- struct in_addr udp_incoming;
+ struct IN_ADDR udp_incoming;
- struct in_addr udp_outgoing;
+ struct IN_ADDR udp_outgoing;
#if SQUID_SNMP
- struct in_addr snmp_incoming;
+ struct IN_ADDR snmp_incoming;
- struct in_addr snmp_outgoing;
+ struct IN_ADDR snmp_outgoing;
#endif
- struct in_addr client_netmask;
+ struct IN_ADDR client_netmask;
}
Addrs;
struct
{
- struct in_addr addr;
+ struct IN_ADDR addr;
int ttl;
unsigned short port;
char *encode_key;
struct _ipcache_addrs
{
- struct in_addr *in_addrs;
+ struct IN_ADDR *in_addrs;
unsigned char *bad_mask;
unsigned char count;
unsigned char cur;
int tcp_up; /* 0 if a connect() fails */
- struct in_addr addresses[10];
+ struct IN_ADDR addresses[10];
int n_addresses;
int rr_count;
int rr_lastcount;
struct _pingerEchoData
{
- struct in_addr to;
+ struct IN_ADDR to;
unsigned char opcode;
int psize;
char payload[PINGER_PAYLOAD_SZ];
struct _pingerReplyData
{
- struct in_addr from;
+ struct IN_ADDR from;
unsigned char opcode;
int rtt;
int hops;
char *dnsserver_msg;
time_t ttl;
- struct in_addr src_addr;
+ struct IN_ADDR src_addr;
char *redirect_url;
ERCB *callback;
void *callback_data;
{
hash_link hash; /* must be first */
- struct in_addr addr;
+ struct IN_ADDR addr;
struct
{
/*
- * $Id: tools.cc,v 1.253 2005/03/18 15:47:42 hno Exp $
+ * $Id: tools.cc,v 1.254 2005/04/18 21:52:43 hno Exp $
*
* DEBUG: section 21 Misc Functions
* AUTHOR: Harvest Derived
const struct hostent *h = NULL;
- struct in_addr sa;
+ struct IN_ADDR sa;
if (Config.visibleHostname != NULL)
return Config.visibleHostname;
#endif
}
-struct in_addr
+struct IN_ADDR
inaddrFromHostent(const struct hostent *hp)
{
- struct in_addr s;
+ struct IN_ADDR s;
xmemcpy(&s.s_addr, hp->h_addr, sizeof(s.s_addr));
return s;
}
/*
- * $Id: wccp.cc,v 1.38 2005/02/05 21:50:42 serassio Exp $
+ * $Id: wccp.cc,v 1.39 2005/04/18 21:52:43 hno Exp $
*
* DEBUG: section 80 WCCP Support
* AUTHOR: Glenn Chisholm
struct wccp_cache_entry_t
{
- struct in_addr ip_addr;
+ struct IN_ADDR ip_addr;
int revision;
char hash[WCCP_HASH_SIZE];
int reserved;
static int last_assign_buckets_change;
static unsigned int number_caches;
-static struct in_addr local_ip;
+static struct IN_ADDR local_ip;
static PF wccpHandleUdp;
static int wccpLowestIP(void);