## Process this file with automake to produce Makefile.in
#
-# $Id: Makefile.am,v 1.27 2006/05/11 01:36:57 hno Exp $
-#
AUTOMAKE_OPTIONS = dist-bzip2 subdir-objects 1.5 foreign
DIST_SUBDIRS = lib snmplib scripts src icons errors contrib doc helpers test-suite tools
-SUBDIRS = lib @makesnmplib@ scripts src icons errors doc helpers test-suite tools
+SUBDIRS = lib @makesnmplib@ scripts src/ip src icons errors doc helpers test-suite tools
DISTCLEANFILES = include/stamp-h include/stamp-h[0-9]*
DEFAULT_PINGER = $(libexecdir)/`echo pinger | sed '$(transform);s/$$/$(EXEEXT)/'`
/*
- * $Id: List.h,v 1.8 2008/02/26 21:49:33 amosjeffries Exp $
- *
- *
* SQUID Web Proxy Cache http://www.squid-cache.org/
* ----------------------------------------------------------
*
hash.c \
heap.c \
html_quote.c \
- IPAddress.cc \
iso3307.c \
md5.c \
radix.c \
tests_testAll_SOURCES= \
tests/testArray.h \
tests/testArray.cc \
- tests/testIPAddress.h \
- tests/testIPAddress.cc \
- IPAddress.cc \
tests/testRFC1035.h \
tests/testRFC1035.cc \
tests/testMain.cc \
-
/*
- * $Id: ACLARP.cc,v 1.29 2008/02/05 22:38:24 amosjeffries Exp $
- *
* DEBUG: section 28 Access Control
* AUTHOR: Duane Wessels
*
#include <squid_windows.h>
#endif
#include "squid.h"
-#include "IPAddress.h"
+#include "ip/IpAddress.h"
#ifdef _SQUID_WIN32_
struct arpreq {
- IPAddress arp_pa; /* protocol address */
+ IpAddress arp_pa; /* protocol address */
struct sockaddr arp_ha; /* hardware address */
int arp_flags; /* flags */
#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, IPAddress &c);
+static int aclMatchArp(SplayNode<acl_arp_data *> **dataptr, IpAddress &c);
static SplayNode<acl_arp_data *>::SPLAYCMP aclArpCompare;
static SplayNode<acl_arp_data *>::SPLAYWALKEE aclDumpArpListWalkee;
/* aclMatchArp */
/***************/
int
-aclMatchArp(SplayNode<acl_arp_data *> **dataptr, IPAddress &c)
+aclMatchArp(SplayNode<acl_arp_data *> **dataptr, IpAddress &c)
{
struct arpreq arpReq;
struct sockaddr_in *sa = NULL;
- IPAddress ipAddr = c;
+ IpAddress ipAddr = c;
#if defined(_SQUID_LINUX_)
/*
- * $Id: ACLASN.h,v 1.10 2008/02/26 21:49:34 amosjeffries Exp $
- *
- *
* SQUID Web Proxy Cache http://www.squid-cache.org/
* ----------------------------------------------------------
*
#include "CbDataList.h"
#include "ACLStrategised.h"
#include "ACLChecklist.h"
-#include "IPAddress.h"
+#include "ip/IpAddress.h"
-SQUIDCEXTERN int asnMatchIp(CbDataList<int> *, IPAddress &);
+SQUIDCEXTERN int asnMatchIp(CbDataList<int> *, IpAddress &);
/// \ingroup ACLAPI
SQUIDCEXTERN void asnInit(void);
SQUIDCEXTERN void asnFreeMemory(void);
/// \ingroup ACLAPI
-class ACLASN : public ACLData<IPAddress>
+class ACLASN : public ACLData<IpAddress>
{
public:
virtual ~ACLASN();
- virtual bool match(IPAddress);
+ virtual bool match(IpAddress);
virtual wordlist *dump();
virtual void parse();
bool empty() const;
- virtual ACLData<IPAddress> *clone() const;
+ virtual ACLData<IpAddress> *clone() const;
virtual void prepareForUse();
private:
static ACL::Prototype SourceRegistryProtoype;
- static ACLStrategised<IPAddress> SourceRegistryEntry_;
+ static ACLStrategised<IpAddress> SourceRegistryEntry_;
static ACL::Prototype DestinationRegistryProtoype;
- static ACLStrategised<IPAddress> DestinationRegistryEntry_;
+ static ACLStrategised<IpAddress> DestinationRegistryEntry_;
CbDataList<int> *data;
};
const acl_access *accessList;
- IPAddress src_addr;
+ IpAddress src_addr;
- IPAddress dst_addr;
+ IpAddress dst_addr;
- IPAddress my_addr;
+ IpAddress my_addr;
struct peer *dst_peer;
/*
- * $Id: ACLDestinationASN.h,v 1.4 2008/02/26 21:49:34 amosjeffries Exp $
- *
- *
* SQUID Web Proxy Cache http://www.squid-cache.org/
* ----------------------------------------------------------
*
#include "ACLASN.h"
#include "ACLStrategy.h"
-#include "IPAddress.h"
+#include "ip/IpAddress.h"
/// \ingroup ACLAPI
-class ACLDestinationASNStrategy : public ACLStrategy<IPAddress>
+class ACLDestinationASNStrategy : public ACLStrategy<IpAddress>
{
public:
int
aclIpAddrNetworkCompare(acl_ip_data * const &p, acl_ip_data * const &q)
{
- IPAddress A = p->addr1;
+ IpAddress A = p->addr1;
/* apply netmask */
A.ApplyMask(q->mask);
* This function should NOT be called if 'asc' is a hostname!
*/
bool
-acl_ip_data::DecodeMask(const char *asc, IPAddress &mask, int ctype)
+acl_ip_data::DecodeMask(const char *asc, IpAddress &mask, int ctype)
{
char junk;
int a1 = 0;
LOCAL_ARRAY(char, mask, 256);
acl_ip_data *r = NULL;
acl_ip_data **Q = NULL;
- IPAddress temp;
+ IpAddress temp;
char c;
unsigned int changed;
acl_ip_data *q = new acl_ip_data;
/*
* Note, must use plain xgetaddrinfo() here because at startup
* ipcache hasn't been initialized
- * TODO: offload this to one of the IPAddress lookups.
+ * TODO: offload this to one of the IpAddress lookups.
*/
debugs(28, 5, "aclIpParseIpData: Lookup Host/IP " << addr1);
struct addrinfo *hp = NULL, *x = NULL;
struct addrinfo hints;
- IPAddress *prev_addr = NULL;
+ IpAddress *prev_addr = NULL;
memset(&hints, 0, sizeof(struct addrinfo));
}
int
-ACLIP::match(IPAddress &clientip)
+ACLIP::match(IpAddress &clientip)
{
static acl_ip_data ClientAddress;
/*
acl_ip_data::acl_ip_data () :addr1(), addr2(), mask(), next (NULL) {}
-acl_ip_data::acl_ip_data (IPAddress const &anAddress1, IPAddress const &anAddress2, IPAddress const &aMask, acl_ip_data *aNext) : addr1(anAddress1), addr2(anAddress2), mask(aMask), next(aNext) {}
+acl_ip_data::acl_ip_data (IpAddress const &anAddress1, IpAddress const &anAddress2, IpAddress const &aMask, acl_ip_data *aNext) : addr1(anAddress1), addr2(anAddress2), mask(aMask), next(aNext) {}
/*
- * $Id$
- *
- *
* SQUID Web Proxy Cache http://www.squid-cache.org/
* ----------------------------------------------------------
*
#include "ACL.h"
#include "splay.h"
-#include "IPAddress.h"
+#include "ip/IpAddress.h"
/// \ingroup ACLAPI
class acl_ip_data
acl_ip_data ();
- acl_ip_data (IPAddress const &, IPAddress const &, IPAddress const &, acl_ip_data *);
+ acl_ip_data (IpAddress const &, IpAddress const &, IpAddress const &, acl_ip_data *);
void toStr(char *buf, int len) const;
- IPAddress addr1;
+ IpAddress addr1;
- IPAddress addr2;
+ IpAddress addr2;
- IPAddress mask; /**< \todo This should perhapse be stored as a CIDR range now instead of a full IP mask. */
+ IpAddress mask; /**< \todo This should perhapse be stored as a CIDR range now instead of a full IP mask. */
acl_ip_data *next; /**< used for parsing, not for storing */
private:
- static bool DecodeMask(const char *asc, IPAddress &mask, int string_format_type);
+ static bool DecodeMask(const char *asc, IpAddress &mask, int string_format_type);
};
MEMPROXY_CLASS_INLINE(acl_ip_data);
protected:
- int match(IPAddress &);
+ int match(IpAddress &);
IPSplay *data;
private:
int
ACLMaxUserIP::match(AuthUserRequest * auth_user_request,
- IPAddress const &src_addr)
+ IpAddress const &src_addr)
{
/*
* the logic for flush the ip list when the limit is hit vs keep
static Prototype RegistryProtoype;
static ACLMaxUserIP RegistryEntry_;
- int match(AuthUserRequest *, IPAddress const &);
+ int match(AuthUserRequest *, IpAddress const &);
char const *class_;
int maximum;
-
/*
- * $Id: ACLSourceASN.h,v 1.3 2007/12/14 23:11:45 amosjeffries Exp $
- *
- *
* SQUID Web Proxy Cache http://www.squid-cache.org/
* ----------------------------------------------------------
*
class ACLChecklist;
#include "ACLStrategy.h"
-#include "IPAddress.h"
+#include "ip/IpAddress.h"
-class ACLSourceASNStrategy : public ACLStrategy<IPAddress>
+class ACLSourceASNStrategy : public ACLStrategy<IpAddress>
{
public:
/*
- * $Id: AccessLogEntry.h,v 1.9 2008/02/26 00:15:48 rousskov Exp $
- *
- *
* SQUID Web Proxy Cache http://www.squid-cache.org/
* ----------------------------------------------------------
*
#include "HttpVersion.h"
#include "HttpRequestMethod.h"
#include "HierarchyLogEntry.h"
-#include "IPAddress.h"
+#include "ip/IpAddress.h"
#include "HttpRequestMethod.h"
/* forward decls */
{;
}
- IPAddress caddr;
+ IpAddress caddr;
int64_t requestSize;
int64_t replySize;
int64_t highOffset;
}
void
-AuthUser::removeIp(IPAddress ipaddr)
+AuthUser::removeIp(IpAddress ipaddr)
{
auth_user_ip_t *ipdata = (auth_user_ip_t *) ip_list.head;
}
void
-AuthUser::addIp(IPAddress ipaddr)
+AuthUser::addIp(IpAddress ipaddr)
{
auth_user_ip_t *ipdata = (auth_user_ip_t *) ip_list.head;
int found = 0;
/* for auth_type_t */
#include "enums.h"
-#include "IPAddress.h"
+#include "ip/IpAddress.h"
#include "dlink.h"
/**
_SQUID_INLINE_ char const *username() const;
_SQUID_INLINE_ void username(char const *);
void clearIp();
- void removeIp(IPAddress);
- void addIp(IPAddress);
+ void removeIp(IpAddress);
+ void addIp(IpAddress);
_SQUID_INLINE_ void addRequest(AuthUserRequest *);
void lock();
}
static void
-authenticateAuthUserRequestSetIp(AuthUserRequest * auth_user_request, IPAddress &ipaddr)
+authenticateAuthUserRequestSetIp(AuthUserRequest * auth_user_request, IpAddress &ipaddr)
{
AuthUser *auth_user = auth_user_request->user();
}
void
-authenticateAuthUserRequestRemoveIp(AuthUserRequest * auth_user_request, IPAddress const &ipaddr)
+authenticateAuthUserRequestRemoveIp(AuthUserRequest * auth_user_request, IpAddress const &ipaddr)
{
AuthUser *auth_user = auth_user_request->user();
* Caller is responsible for locking and unlocking their *auth_user_request!
*/
auth_acl_t
-AuthUserRequest::authenticate(AuthUserRequest ** auth_user_request, http_hdr_type headertype, HttpRequest * request, ConnStateData * conn, IPAddress &src_addr)
+AuthUserRequest::authenticate(AuthUserRequest ** auth_user_request, http_hdr_type headertype, HttpRequest * request, ConnStateData * conn, IpAddress &src_addr)
{
const char *proxy_auth;
assert(headertype != 0);
auth_acl_t
-AuthUserRequest::tryToAuthenticateAndSetAuthUser(AuthUserRequest ** auth_user_request, http_hdr_type headertype, HttpRequest * request, ConnStateData * conn, IPAddress &src_addr)
+AuthUserRequest::tryToAuthenticateAndSetAuthUser(AuthUserRequest ** auth_user_request, http_hdr_type headertype, HttpRequest * request, ConnStateData * conn, IpAddress &src_addr)
{
/* If we have already been called, return the cached value */
AuthUserRequest *t = authTryGetUser (auth_user_request, conn, request);
dlink_node node;
/* IP addr this user authenticated from */
- IPAddress ipaddr;
+ IpAddress ipaddr;
time_t ip_expiretime;
};
virtual void user(AuthUser *aUser) {_auth_user=aUser;}
- static auth_acl_t tryToAuthenticateAndSetAuthUser(AuthUserRequest **, http_hdr_type, HttpRequest *, ConnStateData *, IPAddress &);
+ static auth_acl_t tryToAuthenticateAndSetAuthUser(AuthUserRequest **, http_hdr_type, HttpRequest *, ConnStateData *, IpAddress &);
static void addReplyAuthHeader(HttpReply * rep, AuthUserRequest * auth_user_request, HttpRequest * request, int accelerated, int internal);
AuthUserRequest();
private:
- static auth_acl_t authenticate(AuthUserRequest ** auth_user_request, http_hdr_type headertype, HttpRequest * request, ConnStateData * conn, IPAddress &src_addr);
+ static auth_acl_t authenticate(AuthUserRequest ** auth_user_request, http_hdr_type headertype, HttpRequest * request, ConnStateData * conn, IpAddress &src_addr);
/** return a message on the 407 error pages */
char *message;
extern void authenticateAddTrailer(HttpReply *, AuthUserRequest *, HttpRequest *, int);
/// \ingroup AuthAPI
-extern void authenticateAuthUserRequestRemoveIp(AuthUserRequest *, IPAddress const &);
+extern void authenticateAuthUserRequestRemoveIp(AuthUserRequest *, IpAddress const &);
/// \ingroup AuthAPI
extern void authenticateAuthUserRequestClearIp(AuthUserRequest *);
/// \ingroup AuthAPI
/*
- * $Id: CompositePoolNode.h,v 1.10 2008/02/26 21:49:34 amosjeffries Exp $
- *
* DEBUG: section 77 Delay Pools
* AUTHOR: Robert Collins <robertc@squid-cache.org>
* Based upon original delay pools code by
#include "DelayPools.h"
#include "DelayIdComposite.h"
#include "CommRead.h"
-#include "IPAddress.h"
+#include "ip/IpAddress.h"
class StoreEntry;
public:
CompositeSelectionDetails() {}
- IPAddress src_addr;
+ IpAddress src_addr;
AuthUserRequest *user;
String tag;
};
DeferredReadManager deferredReads;
};
-#endif
+#endif /* DELAY_POOLS */
#endif /* COMPOSITEPOOLNODE_H */
/*
- * $Id: ConnectionDetail.h,v 1.4 2007/12/14 23:11:45 amosjeffries Exp $
- *
* DEBUG: section 5 Socket Functions
* AUTHOR: Robert Collins
*
#ifndef _SQUIDCONNECTIONDETAIL_H_
#define _SQUIDCONNECTIONDETAIL_H_
-#include "IPAddress.h"
+#include "ip/IpAddress.h"
class ConnectionDetail
{
ConnectionDetail();
- IPAddress me;
+ IpAddress me;
- IPAddress peer;
+ IpAddress peer;
};
#endif
char skey1[32];
char skey2[32];
char skey3[32];
- IPAddress localhost;
+ IpAddress localhost;
ikey = (getpid() << 10) + (instanceID << 2);
ikey &= 0x7fffffff;
-
/*
- * $Id: ESI.cc,v 1.30 2008/02/26 21:49:34 amosjeffries Exp $
- *
* DEBUG: section 86 ESI processing
* AUTHOR: Robert Collins
*
#include "ESIExpression.h"
#include "HttpRequest.h"
#include "MemBuf.h"
-#include "IPAddress.h"
+#include "ip/IpAddress.h"
/* quick reference on behaviour here.
* The ESI specification 1.0 requires the ESI processor to be able to
/* don't touch incoming, it's a pointer into buffered anyway */
}
-extern ErrorState *clientBuildError (err_type, http_status, char const *, IPAddress &, HttpRequest *);
+extern ErrorState *clientBuildError (err_type, http_status, char const *, IpAddress &, HttpRequest *);
/* This can ONLY be used before we have sent *any* data to the client */
ConnStateData *pinned_connection;
public:
- IPAddress host_addr;
+ IpAddress host_addr;
AuthUserRequest *auth_user_request;
int max_forwards;
- IPAddress client_addr;
+ IpAddress client_addr;
#if FOLLOW_X_FORWARDED_FOR
- IPAddress indirect_client_addr;
+ IpAddress indirect_client_addr;
#endif /* FOLLOW_X_FORWARDED_FOR */
- IPAddress my_addr;
+ IpAddress my_addr;
HierarchyLogEntry hier;
// TODO: obey service-specific, OPTIONS-reported connection limit
void ICAPXaction::openConnection()
{
- IPAddress client_addr;
+ IpAddress client_addr;
Must(connection < 0);
disableRetries(); // we only retry pconn failures
- IPAddress outgoing;
+ IpAddress outgoing;
connection = comm_open(SOCK_STREAM, 0, outgoing,
COMM_NONBLOCKING, s.cfg().uri.buf());
}
if (reuseConnection) {
- IPAddress client_addr;
+ IpAddress client_addr;
debugs(93,3, HERE << "pushing pconn" << status());
AsyncCall::Pointer call = NULL;
commSetTimeout(connection, -1, call);
_icp_common_t();
_icp_common_t(char *buf, unsigned int len);
- void handleReply(char *buf, IPAddress &from);
+ void handleReply(char *buf, IpAddress &from);
static _icp_common_t *createMessage(icp_opcode opcode, int flags, const char *url, int reqnum, int pad);
icp_opcode getOpCode() const;
#endif
HttpRequest *request;
int fd;
- IPAddress from;
+ IpAddress from;
char *url;
};
/// \ingroup ServerProtocolICPAPI
struct icpUdpData {
- IPAddress address;
+ IpAddress address;
void *msg;
size_t len;
icpUdpData *next;
};
/// \ingroup ServerProtocolICPAPI
-HttpRequest* icpGetRequest(char *url, int reqnum, int fd, IPAddress &from);
+HttpRequest* icpGetRequest(char *url, int reqnum, int fd, IpAddress &from);
/// \ingroup ServerProtocolICPAPI
-int icpAccessAllowed(IPAddress &from, HttpRequest * icp_request);
+int icpAccessAllowed(IpAddress &from, HttpRequest * icp_request);
/// \ingroup ServerProtocolICPAPI
-SQUIDCEXTERN void icpCreateAndSend(icp_opcode, int flags, char const *url, int reqnum, int pad, int fd, const IPAddress &from);
+SQUIDCEXTERN void icpCreateAndSend(icp_opcode, int flags, char const *url, int reqnum, int pad, int fd, const IpAddress &from);
/// \ingroup ServerProtocolICPAPI
extern icp_opcode icpGetCommonOpcode();
/// \ingroup ServerProtocolICPAPI
-SQUIDCEXTERN int icpUdpSend(int, const IPAddress &, icp_common_t *, log_type, int);
+SQUIDCEXTERN int icpUdpSend(int, const IpAddress &, icp_common_t *, log_type, int);
/// \ingroup ServerProtocolICPAPI
SQUIDCEXTERN log_type icpLogFromICPCode(icp_opcode opcode);
/// \ingroup ServerProtocolICPAPI
-void icpDenyAccess(IPAddress &from, char *url, int reqnum, int fd);
+void icpDenyAccess(IpAddress &from, char *url, int reqnum, int fd);
/// \ingroup ServerProtocolICPAPI
SQUIDCEXTERN PF icpHandleUdp;
SQUIDCEXTERN PF icpUdpSendQueue;
/// \ingroup ServerProtocolICPAPI
-SQUIDCEXTERN void icpHandleIcpV3(int, IPAddress &, char *, int);
+SQUIDCEXTERN void icpHandleIcpV3(int, IpAddress &, char *, int);
/// \ingroup ServerProtocolICPAPI
SQUIDCEXTERN int icpCheckUdpHit(StoreEntry *, HttpRequest * request);
#
# Makefile for the Squid Object Cache server
#
-# $Id: Makefile.am,v 1.201 2008/02/26 00:19:29 rousskov Exp $
-#
# Uncomment and customize the following to suit your needs:
#
cf_gen.cc \
defines.h \
debug.cc \
- ip/stubQosConfig.cc \
time.cc
nodist_cf_gen_SOURCES = globals.cc
nodist_cf_gen_HEADER = cf_gen_defines.h
+cf_gen_LDADD= \
+ libsquid.la \
+ libauth.la \
+ ip/libip.la \
+ -L../lib -lmiscutil \
+ @XTRA_LIBS@ \
+ @EPOLL_LIBS@ \
+ @MINGW_LIBS@
cf_gen.$(OBJEXT): cf_gen_defines.h
all_FSMODULES = \
## client_db wants SNMP_SOURCE
## snmp_core wants ACLStringData
## SwapDir wants ConfigOption
-## tools.cc wants libip.la
-## client_side.cc wants libip.la
+## tools.cc wants ip/libip.la
+## client_side.cc wants ip/libip.la
ufsdump_SOURCES = \
debug.cc \
int.cc \
data_DATA = \
mib.txt
-LDADD = libsquid.la libauth.la -L../lib -lmiscutil @XTRA_LIBS@ @EPOLL_LIBS@ @MINGW_LIBS@
+LDADD = libsquid.la libauth.la ip/libip.la -L../lib -lmiscutil @XTRA_LIBS@ @EPOLL_LIBS@ @MINGW_LIBS@
EXTRA_DIST = \
cf_gen_defines \
tests/stub_store.cc HttpHeaderTools.cc HttpHeader.cc acl.cc mem.cc \
MemBuf.cc HttpHdrContRange.cc Packer.cc ACLChecklist.cc HttpHdrCc.cc HttpHdrSc.cc \
HttpHdrScTarget.cc url.cc ACLProxyAuth.cc ACLRegexData.cc ACLUserData.cc \
- ip/stubQosConfig.cc \
StatHist.cc HttpHdrRange.cc ETag.cc tests/stub_errorpage.cc \
tests/stub_HttpRequest.cc tests/stub_DelayId.cc \
tests/stub_MemObject.cc mem_node.cc \
tests_testAuth_LDADD= \
libsquid.la \
libauth.la \
+ ip/libip.la \
@AUTH_LINKOBJS@ @AUTH_OBJS@ \
-L../lib -lmiscutil \
@REGEXLIB@ \
mem_node.cc \
Packer.cc \
Parsing.cc \
- ip/stubQosConfig.cc \
StatHist.cc \
stmem.cc \
String.cc \
tests_testACLMaxUserIP_LDADD= \
libsquid.la \
libauth.la \
+ ip/libip.la \
-L../lib -lmiscutil \
@REGEXLIB@ \
@SQUID_CPPUNIT_LIBS@ \
nodist_tests_testDiskIO_SOURCES= \
$(SWAP_TEST_GEN_SOURCES)
tests_testDiskIO_LDADD = \
+ ip/libip.la \
@DISK_LIBS@ \
$(SWAP_TEST_LDADD) \
SquidConfig.o
tests_testStore_LDADD= \
libsquid.la \
libauth.la \
+ ip/libip.la \
-L../lib -lmiscutil \
@REGEXLIB@ \
@SQUID_CPPUNIT_LIBS@ \
# libsquid pulls in SquidConfig and children. stub them.
tests_testString_SOURCES = \
mem.cc \
- ip/stubQosConfig.cc \
String.cc \
tests/testMain.cc \
tests/testString.cc \
$(TESTSOURCES)
tests_testString_LDADD = \
libsquid.la \
+ ip/libip.la \
-L../lib -lmiscutil \
@REGEXLIB@ \
@SQUID_CPPUNIT_LIBS@ \
$(SWAP_TEST_GEN_SOURCES)
tests_testUfs_LDADD = \
libsquid.la \
+ ip/libip.la \
$(SWAP_TEST_LDADD) \
@SSLLIB@
tests_testUfs_LDFLAGS = $(LIBADD_DL)
-
/*
- * $Id: PeerSelectState.h,v 1.3 2007/12/14 23:11:45 amosjeffries Exp $
- *
* AUTHOR: Robert Collins
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
#include "cbdata.h"
#include "PingData.h"
-#include "IPAddress.h"
+#include "ip/IpAddress.h"
class ps_state
{
void *callback_data;
FwdServer *servers;
/*
- * Why are these IPAddress instead of peer *? Because a
+ * Why are these IpAddress instead of peer *? Because a
* peer structure can become invalid during the peer selection
* phase, specifically after a reconfigure. Thus we need to lookup
* the peer * based on the address when we are finally ready to
* reference the peer structure.
*/
- IPAddress first_parent_miss;
+ IpAddress first_parent_miss;
- IPAddress closest_parent_miss;
+ IpAddress closest_parent_miss;
/*
* ->hit can be peer* because it should only be
* accessed during the thread when it is set
http_port_list *next;
- IPAddress s;
+ IpAddress s;
char *protocol; /* protocol name */
char *name; /* visible name */
char *defaultsite; /* default web site */
/*
- * $Id: SquidTime.h,v 1.4 2007/12/14 23:11:45 amosjeffries Exp $
- *
* DEBUG: section 21 Time Functions
* AUTHOR: Harvest Derived
*
#ifndef SQUID_TIME_H
#define SQUID_TIME_H
-#include "squid.h"
+#include "config.h"
+
+#if HAVE_TIME_H
+#include <time.h>
+#endif
+#if HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+
/* globals for accessing time */
extern struct timeval current_time;
{
public:
uint8_t len;
- IPAddress addr;
+ IpAddress addr;
- m_ADDR() : len(sizeof(IPAddress)) {};
+ m_ADDR() : len(sizeof(IpAddress)) {};
};
/* END of definitions for radix tree entries */
/* PUBLIC */
int
-asnMatchIp(CbDataList<int> *data, IPAddress &addr)
+asnMatchIp(CbDataList<int> *data, IpAddress &addr)
{
struct squid_radix_node *rn;
as_info *e;
CbDataList<int> *q = NULL;
as_info *asinfo = NULL;
- IPAddress mask;
- IPAddress addr;
+ IpAddress mask;
+ IpAddress addr;
char *t;
int bitl;
CbDataList<int> *q;
as_info *asinfo;
char buf[MAX_IPSTRLEN];
- IPAddress addr;
- IPAddress mask;
+ IpAddress addr;
+ IpAddress mask;
assert(e);
assert(e->e_info);
bool
-ACLASN::match(IPAddress toMatch)
+ACLASN::match(IpAddress toMatch)
{
return asnMatchIp(data, toMatch);
}
}
}
-ACLData<IPAddress> *
+ACLData<IpAddress> *
ACLASN::clone() const
{
if (data)
/* explicit template instantiation required for some systems */
-template class ACLStrategised<IPAddress>;
+template class ACLStrategised<IpAddress>;
ACL::Prototype ACLASN::SourceRegistryProtoype(&ACLASN::SourceRegistryEntry_, "src_as");
-ACLStrategised<IPAddress> ACLASN::SourceRegistryEntry_(new ACLASN, ACLSourceASNStrategy::Instance(), "src_as");
+ACLStrategised<IpAddress> ACLASN::SourceRegistryEntry_(new ACLASN, ACLSourceASNStrategy::Instance(), "src_as");
ACL::Prototype ACLASN::DestinationRegistryProtoype(&ACLASN::DestinationRegistryEntry_, "dst_as");
-ACLStrategised<IPAddress> ACLASN::DestinationRegistryEntry_(new ACLASN, ACLDestinationASNStrategy::Instance(), "dst_as");
+ACLStrategised<IpAddress> ACLASN::DestinationRegistryEntry_(new ACLASN, ACLDestinationASNStrategy::Instance(), "dst_as");
int
-ACLSourceASNStrategy::match (ACLData<IPAddress> * &data, ACLChecklist *checklist)
+ACLSourceASNStrategy::match (ACLData<IpAddress> * &data, ACLChecklist *checklist)
{
return data->match(checklist->src_addr);
}
debugs(28, 3, "asnMatchAcl: Can't yet compare '" << "unknown" /*name*/ << "' ACL for '" << checklist->request->GetHost() << "'");
checklist->changeState (DestinationIPLookup::Instance());
} else {
- IPAddress noaddr;
+ IpAddress noaddr;
noaddr.SetNoAddr();
return data->match(noaddr);
}
} else {
const char *useragent = request->header.getStr(HDR_USER_AGENT);
- static IPAddress last_broken_addr;
+ static IpAddress last_broken_addr;
static int seen_broken_client = 0;
if (!seen_broken_client) {
static void free_denyinfo(acl_deny_info_list ** var);
#if USE_WCCPv2
-static void parse_IPAddress_list(IPAddress_list **);
-static void dump_IPAddress_list(StoreEntry *, const char *, const IPAddress_list *);
-static void free_IPAddress_list(IPAddress_list **);
+static void parse_IpAddress_list(IpAddress_list **);
+static void dump_IpAddress_list(StoreEntry *, const char *, const IpAddress_list *);
+static void free_IpAddress_list(IpAddress_list **);
#if CURRENTLY_UNUSED
-static int check_null_IPAddress_list(const IPAddress_list *);
+static int check_null_IpAddress_list(const IpAddress_list *);
#endif /* CURRENTLY_UNUSED */
#endif /* USE_WCCPv2 */
}
static void
-dump_address(StoreEntry * entry, const char *name, IPAddress &addr)
+dump_address(StoreEntry * entry, const char *name, IpAddress &addr)
{
char buf[MAX_IPSTRLEN];
storeAppendPrintf(entry, "%s %s\n", name, addr.NtoA(buf,MAX_IPSTRLEN) );
}
static void
-parse_address(IPAddress *addr)
+parse_address(IpAddress *addr)
{
char *token = strtok(NULL, w_space);
}
static void
-free_address(IPAddress *addr)
+free_address(IpAddress *addr)
{
addr->SetEmpty();
}
#if USE_WCCPv2
void
-parse_IPAddress_list_token(IPAddress_list ** head, char *token)
+parse_IpAddress_list_token(IpAddress_list ** head, char *token)
{
char *t;
char *host;
char *tmp;
- IPAddress ipa;
+ IpAddress ipa;
unsigned short port;
- IPAddress_list *s;
+ IpAddress_list *s;
host = NULL;
port = 0;
while (*head)
head = &(*head)->next;
- s = static_cast<IPAddress_list *>(xcalloc(1, sizeof(*s)));
+ s = static_cast<IpAddress_list *>(xcalloc(1, sizeof(*s)));
s->s = ipa;
*head = s;
}
static void
-parse_IPAddress_list(IPAddress_list ** head)
+parse_IpAddress_list(IpAddress_list ** head)
{
char *token;
while ((token = strtok(NULL, w_space))) {
- parse_IPAddress_list_token(head, token);
+ parse_IpAddress_list_token(head, token);
}
}
static void
-dump_IPAddress_list(StoreEntry * e, const char *n, const IPAddress_list * s)
+dump_IpAddress_list(StoreEntry * e, const char *n, const IpAddress_list * s)
{
char ntoabuf[MAX_IPSTRLEN];
}
static void
-free_IPAddress_list(IPAddress_list ** head)
+free_IpAddress_list(IpAddress_list ** head)
{
if (*head) delete *head;
*head = NULL;
* be used by icp_port and htcp_port
*/
static int
-check_null_IPAddress_list(const IPAdress_list * s)
+check_null_IpAddress_list(const IPAdress_list * s)
{
return NULL == s;
}
refreshpattern
removalpolicy
size_t
-IPAddress_list
+IpAddress_list
string
string
time_t
DOC_END
NAME: wccp2_router
-TYPE: IPAddress_list
+TYPE: IpAddress_list
LOC: Config.Wccp2.router
DEFAULT: none
IFDEF: USE_WCCPv2
-
/*
- * $Id: cf_gen.cc,v 1.62 2007/09/17 20:21:23 hno Exp $
- *
* DEBUG: none Generate squid.conf.default and cf_parser.h
* AUTHOR: Max Okumoto
*
* administrator.
*****************************************************************************/
-#include "squid.h"
-#include "SquidTime.h"
+//#include "squid.h"
+#include "config.h"
+#include "assert.h"
+//#include "SquidTime.h"
#include "cf_gen_defines.h"
+#include "util.h"
+
+#if HAVE_STRING_H
+#include <string.h>
+#endif
+#if HAVE_STRING_H
+#include <ctype.h>
+#endif
#define MAX_LINE 1024 /* longest configuration line */
#define _PATH_PARSER "cf_parser.h"
static hash_table *client_table = NULL;
-static ClientInfo *clientdbAdd(const IPAddress &addr);
+static ClientInfo *clientdbAdd(const IpAddress &addr);
static FREE clientdbFreeItem;
static void clientdbStartGC(void);
static void clientdbScheduledGC(void *);
static ClientInfo *
-clientdbAdd(const IPAddress &addr)
+clientdbAdd(const IpAddress &addr)
{
ClientInfo *c;
char *buf = new char[MAX_IPSTRLEN];
}
void
-clientdbUpdate(const IPAddress &addr, log_type ltype, protocol_t p, size_t size)
+clientdbUpdate(const IpAddress &addr, log_type ltype, protocol_t p, size_t size)
{
char key[MAX_IPSTRLEN];
ClientInfo *c;
* -1. To get the current value, simply call with delta = 0.
*/
int
-clientdbEstablished(const IPAddress &addr, int delta)
+clientdbEstablished(const IpAddress &addr, int delta)
{
char key[MAX_IPSTRLEN];
ClientInfo *c;
#define CUTOFF_SECONDS 3600
int
-clientdbCutoffDenied(const IPAddress &addr)
+clientdbCutoffDenied(const IpAddress &addr)
{
char key[MAX_IPSTRLEN];
int NR;
#if SQUID_SNMP
-IPAddress *
-client_entry(IPAddress *current)
+IpAddress *
+client_entry(IpAddress *current)
{
ClientInfo *c = NULL;
char key[MAX_IPSTRLEN];
static int connKeepReadingIncompleteRequest(ConnStateData * conn);
static void connCancelIncompleteRequests(ConnStateData * conn);
-static ConnStateData *connStateCreate(const IPAddress &peer, const IPAddress &me, int fd, http_port_list *port);
+static ConnStateData *connStateCreate(const IpAddress &peer, const IpAddress &me, int fd, http_port_list *port);
int
}
ConnStateData *
-connStateCreate(const IPAddress &peer, const IPAddress &me, int fd, http_port_list *port)
+connStateCreate(const IpAddress &peer, const IpAddress &me, int fd, http_port_list *port)
{
ConnStateData *result = new ConnStateData;
result->port = cbdataReference(port);
if (port->intercepted || port->spoof_client_ip) {
- IPAddress client, dst;
+ IpAddress client, dst;
if (IpInterceptor.NatLookup(fd, me, peer, client, dst) == 0) {
result->me = client;
*/
ClientSocketContext::Pointer currentobject;
- IPAddress peer;
+ IpAddress peer;
- IPAddress me;
+ IpAddress me;
- IPAddress log_addr;
+ IpAddress log_addr;
char rfc931[USER_IDENT_SZ];
int nrequests;
/* Local functions */
extern "C" CSS clientReplyStatus;
-extern ErrorState *clientBuildError(err_type, http_status, char const *, IPAddress &, HttpRequest *);
+extern ErrorState *clientBuildError(err_type, http_status, char const *, IpAddress &, HttpRequest *);
/* privates */
void
clientReplyContext::setReplyToError(
err_type err, http_status status, const HttpRequestMethod& method, char const *uri,
- IPAddress &addr, HttpRequest * failedrequest, char *unparsedrequest,
+ IpAddress &addr, HttpRequest * failedrequest, char *unparsedrequest,
AuthUserRequest * auth_user_request)
{
ErrorState *errstate =
void
clientReplyContext::sendBodyTooLargeError()
{
- IPAddress tmp_noaddr;
+ IpAddress tmp_noaddr;
tmp_noaddr.SetNoAddr(); // TODO: make a global const
ErrorState *err = clientBuildError(ERR_TOO_BIG, HTTP_FORBIDDEN, NULL,
http->getConn() != NULL ? http->getConn()->peer : tmp_noaddr,
if (page_id == ERR_NONE)
page_id = ERR_ACCESS_DENIED;
- IPAddress tmp_noaddr;
+ IpAddress tmp_noaddr;
tmp_noaddr.SetNoAddr();
err = clientBuildError(page_id, HTTP_FORBIDDEN, NULL,
http->getConn() != NULL ? http->getConn()->peer : tmp_noaddr,
ErrorState *
clientBuildError(err_type page_id, http_status status, char const *url,
- IPAddress &src_addr, HttpRequest * request)
+ IpAddress &src_addr, HttpRequest * request)
{
ErrorState *err = errorCon(page_id, status, request);
err->src_addr = src_addr;
-
/*
- * $Id: client_side_reply.h,v 1.21 2008/02/08 18:31:02 rousskov Exp $
- *
- *
* SQUID Web Proxy Cache http://www.squid-cache.org/
* ----------------------------------------------------------
*
#include "clientStream.h"
#include "StoreClient.h"
#include "client_side_request.h"
-#include "IPAddress.h"
class ErrorState;
+class IpAddress;
/* XXX make static method */
int storeOKTransferDone() const;
int storeNotOKTransferDone() const;
- void setReplyToError(err_type, http_status, const HttpRequestMethod&, char const *, IPAddress &, HttpRequest *, char *, AuthUserRequest *);
+ void setReplyToError(err_type, http_status, const HttpRequestMethod&, char const *, IpAddress &, HttpRequest *, char *, AuthUserRequest *);
void createStoreEntry(const HttpRequestMethod& m, request_flags flags);
void removeStoreReference(store_client ** scp, StoreEntry ** ep);
void removeClientStoreReference(store_client **scp, ClientHttpRequest *http);
clientStreamNode *node = (clientStreamNode *)http->client_stream.tail->prev->data;
clientReplyContext *repContext = dynamic_cast<clientReplyContext *>(node->data.getRaw());
assert (repContext);
- IPAddress tmpnoaddr;
+ IpAddress tmpnoaddr;
tmpnoaddr.SetNoAddr();
repContext->setReplyToError(page_id, status,
http->request->method, NULL,
// The original author of the code also wanted to pass an errno to
// setReplyToError, but it seems unlikely that the errno reflects the
// true cause of the error at this point, so I did not pass it.
- IPAddress noAddr;
+ IpAddress noAddr;
noAddr.SetNoAddr();
ConnStateData * c = getConn();
repContext->setReplyToError(ERR_ICAP_FAILURE, HTTP_INTERNAL_SERVER_ERROR,
-
/*
- * $Id: comm.cc,v 1.447 2008/02/26 21:49:34 amosjeffries Exp $
- *
* DEBUG: section 5 Socket Functions
* AUTHOR: Harvest Derived
*
#include "pconn.h"
#include "SquidTime.h"
#include "CommCalls.h"
-#include "IPAddress.h"
#include "DescriptorSet.h"
#include "icmp/net_db.h"
+#include "ip/IpAddress.h"
#include "ip/IpIntercept.h"
#if defined(_SQUID_CYGWIN_)
// defaults given by client
char *host;
u_short default_port;
- IPAddress default_addr;
+ IpAddress default_addr;
// NP: CANNOT store the default addr:port together as it gets set/reset differently.
- IPAddress S;
+ IpAddress S;
AsyncCall::Pointer callback;
int fd;
* synchronous wrapper around udp socket functions
*/
int
-comm_udp_recvfrom(int fd, void *buf, size_t len, int flags, IPAddress &from)
+comm_udp_recvfrom(int fd, void *buf, size_t len, int flags, IpAddress &from)
{
statCounter.syscalls.sock.recvfroms++;
int x = 0;
int
comm_udp_recv(int fd, void *buf, size_t len, int flags)
{
- IPAddress nul;
+ IpAddress nul;
return comm_udp_recvfrom(fd, buf, len, flags, nul);
}
u_short
comm_local_port(int fd)
{
- IPAddress temp;
+ IpAddress temp;
struct addrinfo *addr = NULL;
fde *F = &fd_table[fd];
int
comm_open(int sock_type,
int proto,
- IPAddress &addr,
+ IpAddress &addr,
int flags,
const char *note)
{
int
comm_openex(int sock_type,
int proto,
- IPAddress &addr,
+ IpAddress &addr,
int flags,
unsigned char TOS,
const char *note)
ConnectStateData::commResetFD()
{
struct addrinfo *AI = NULL;
- IPAddress nul;
+ IpAddress nul;
int new_family = AF_UNSPEC;
// XXX: do we have to check this?
}
int
-comm_connect_addr(int sock, const IPAddress &address)
+comm_connect_addr(int sock, const IpAddress &address)
{
comm_err_t status = COMM_OK;
fde *F = &fd_table[sock];
/* Send a udp datagram to specified TO_ADDR. */
int
comm_udp_sendto(int fd,
- const IPAddress &to_addr,
+ const IpAddress &to_addr,
const void *buf,
int len)
{
#include "AsyncCall.h"
#include "StoreIOBuffer.h"
#include "Array.h"
-#include "IPAddress.h"
+#include "ip/IpAddress.h"
#define COMMIO_FD_READCB(fd) (&commfd_table[(fd)].readcb)
#define COMMIO_FD_WRITECB(fd) (&commfd_table[(fd)].writecb)
SQUIDCEXTERN void commConnectStart(int fd, const char *, u_short, CNCB *, void *);
void commConnectStart(int fd, const char *, u_short, AsyncCall::Pointer &cb);
-SQUIDCEXTERN int comm_connect_addr(int sock, const IPAddress &addr);
+SQUIDCEXTERN int comm_connect_addr(int sock, const IpAddress &addr);
SQUIDCEXTERN void comm_init(void);
SQUIDCEXTERN void comm_exit(void);
-SQUIDCEXTERN int comm_open(int, int, IPAddress &, int, const char *note);
+SQUIDCEXTERN int comm_open(int, int, IpAddress &, int, const char *note);
-SQUIDCEXTERN int comm_openex(int, int, IPAddress &, int, unsigned char TOS, const char *);
+SQUIDCEXTERN int comm_openex(int, int, IpAddress &, int, unsigned char TOS, const char *);
SQUIDCEXTERN u_short comm_local_port(int fd);
SQUIDCEXTERN int comm_set_tos(int fd, int tos);
SQUIDCEXTERN void commSetSelect(int, unsigned int, PF *, void *, time_t);
SQUIDCEXTERN void commResetSelect(int);
-SQUIDCEXTERN int comm_udp_sendto(int sock, const IPAddress &to, const void *buf, int buflen);
+SQUIDCEXTERN int comm_udp_sendto(int sock, const IpAddress &to, const void *buf, int buflen);
extern void comm_write(int fd, const char *buf, int len, IOCB *callback, void *callback_data, FREE *func);
extern void comm_write(int fd, const char *buf, int size, AsyncCall::Pointer &callback, FREE * free_func = NULL);
SQUIDCEXTERN void comm_write_mbuf(int fd, MemBuf *mb, IOCB * handler, void *handler_data);
extern void comm_read(int fd, char *buf, int len, AsyncCall::Pointer &callback);
extern void comm_read_cancel(int fd, IOCB *callback, void *data);
extern void comm_read_cancel(int fd, AsyncCall::Pointer &callback);
-extern int comm_udp_recvfrom(int fd, void *buf, size_t len, int flags, IPAddress &from);
+extern int comm_udp_recvfrom(int fd, void *buf, size_t len, int flags, IpAddress &from);
extern int comm_udp_recv(int fd, void *buf, size_t len, int flags);
extern ssize_t comm_udp_send(int s, const void *buf, size_t len, int flags);
extern bool comm_has_incomplete_write(int);
/*
- * $Id: delay_pools.cc,v 1.51 2008/02/26 21:49:34 amosjeffries Exp $
- *
* DEBUG: section 77 Delay Pools
* AUTHOR: Robert Collins <robertc@squid-cache.org>
* Based upon original delay pools code by
#include "DelayBucket.h"
#include "DelayUser.h"
#include "DelayTagged.h"
-#include "IPAddress.h"
+#include "ip/IpAddress.h"
/// \ingroup DelayPoolsInternal
long DelayPools::MemoryUsed = 0;
virtual char const *label() const = 0;
- virtual unsigned int makeKey (IPAddress &src_addr) const = 0;
+ virtual unsigned int makeKey (IpAddress &src_addr) const = 0;
DelaySpec spec;
protected:
virtual char const *label() const {return "Individual";}
- virtual unsigned int makeKey (IPAddress &src_addr) const;
+ virtual unsigned int makeKey (IpAddress &src_addr) const;
};
protected:
virtual char const *label() const {return "Network";}
- virtual unsigned int makeKey (IPAddress &src_addr) const;
+ virtual unsigned int makeKey (IpAddress &src_addr) const;
};
/* don't use remote storage for these */
virtual char const *label() const {return "Individual";}
- virtual unsigned int makeKey (IPAddress &src_addr) const;
+ virtual unsigned int makeKey (IpAddress &src_addr) const;
- unsigned char makeHostKey (IPAddress &src_addr) const;
+ unsigned char makeHostKey (IpAddress &src_addr) const;
DelaySpec spec;
VectorMap<unsigned char, ClassCBucket> buckets;
}
unsigned int
-IndividualPool::makeKey (IPAddress &src_addr) const
+IndividualPool::makeKey (IpAddress &src_addr) const
{
/* FIXME INET6 : IPv6 requires a 64-128 bit result from this function */
if ( !src_addr.IsIPv4() )
}
unsigned int
-ClassCNetPool::makeKey (IPAddress &src_addr) const
+ClassCNetPool::makeKey (IpAddress &src_addr) const
{
/* FIXME INET6 : IPv6 requires a 64-128 bit result from this function */
if ( !src_addr.IsIPv4() )
}
unsigned char
-ClassCHostPool::makeHostKey (IPAddress &src_addr) const
+ClassCHostPool::makeHostKey (IpAddress &src_addr) const
{
/* FIXME INET6 : IPv6 requires a 64-128 bit result from this function */
if ( !src_addr.IsIPv4() )
}
unsigned int
-ClassCHostPool::makeKey (IPAddress &src_addr) const
+ClassCHostPool::makeKey (IpAddress &src_addr) const
{
/* FIXME INET6 : IPv6 requires a 64-128 bit result from this function */
if ( !src_addr.IsIPv4() )
};
struct _ns {
- IPAddress S;
+ IpAddress S;
int nqueries;
int nreplies;
nsvc *vc;
static IOCB idnsReadVCHeader;
static void idnsDoSendQueryVC(nsvc *vc);
-static int idnsFromKnownNameserver(IPAddress const &from);
+static int idnsFromKnownNameserver(IpAddress const &from);
static idns_query *idnsFindQuery(unsigned short id);
static void idnsGrokReply(const char *buf, size_t sz);
static PF idnsRead;
static void
idnsAddNameserver(const char *buf)
{
- IPAddress A;
+ IpAddress A;
if (!(A = buf)) {
debugs(78, 0, "WARNING: rejecting '" << buf << "' as a name server, because it is not a numeric IP address");
nameservers[ns].vc = vc;
vc->ns = ns;
- IPAddress addr;
+ IpAddress addr;
if (!Config.Addrs.udp_outgoing.IsNoAddr())
addr = Config.Addrs.udp_outgoing;
}
static int
-idnsFromKnownNameserver(IPAddress const &from)
+idnsFromKnownNameserver(IpAddress const &from)
{
int i;
int max = INCOMING_DNS_MAX;
static char rbuf[SQUID_UDP_SO_RCVBUF];
int ns;
- IPAddress from;
+ IpAddress from;
debugs(78, 3, "idnsRead: starting with FD " << fd);
* The cause of this is still unknown, however copying the data appears
* to allow it to be passed further without this erasure.
*/
- IPAddress bugbypass;
+ IpAddress bugbypass;
while (max--) {
len = comm_udp_recvfrom(fd, rbuf, SQUID_UDP_SO_RCVBUF, 0, bugbypass);
if (DnsSocket < 0) {
int port;
- IPAddress addr;
+ IpAddress addr;
if (!Config.Addrs.udp_outgoing.IsNoAddr())
addr = Config.Addrs.udp_outgoing;
}
void
-idnsPTRLookup(const IPAddress &addr, IDNSCB * callback, void *data)
+idnsPTRLookup(const IpAddress &addr, IDNSCB * callback, void *data)
{
idns_query *q;
-
/*
- * $Id: dnsserver.cc,v 1.74 2008/02/26 21:49:34 amosjeffries Exp $
- *
* DEBUG: section 0 DNS Resolver
* AUTHOR: Harvest Derived
*
\endverbatim
*/
-#include "IPAddress.h"
+#include "ip/IpAddress.h"
#if LIBRESOLV_DNS_TTL_HACK
/// \ingroup dnsserver
int ttl = 0;
int retry = 0;
unsigned int i = 0;
- IPAddress ipa;
+ IpAddress ipa;
char ntoabuf[MAX_IPSTRLEN];
struct addrinfo hints;
struct addrinfo *AI = NULL;
#endif
#if HAVE_RES_INIT
- IPAddress ipa;
+ IpAddress ipa;
int opt_s = 0;
#ifdef _SQUID_RES_NSADDR_LIST
/*
- * $Id: errorpage.h,v 1.6 2008/02/26 21:49:34 amosjeffries Exp $
- *
* DEBUG: section 4 Error Generation
* AUTHOR: Duane Wessels
*
#include "squid.h"
#include "cbdata.h"
-#include "IPAddress.h"
+#include "ip/IpAddress.h"
/**
\defgroup ErrorPageAPI Error Pages API
char *dnsserver_msg;
time_t ttl;
- IPAddress src_addr;
+ IpAddress src_addr;
char *redirect_url;
ERCB *callback;
void *callback_data;
QUOTE_METHOD_URL
} quote;
- IPAddress local_addr;
+ IpAddress local_addr;
};
struct _external_acl_format {
-
/*
- * $Id: fde.h,v 1.15 2008/02/12 23:22:13 rousskov Exp $
- *
- *
* SQUID Web Proxy Cache http://www.squid-cache.org/
* ----------------------------------------------------------
*
#define SQUID_FDE_H
#include "comm.h"
-#include "IPAddress.h"
+#include "ip/IpAddress.h"
class PconnPool;
unsigned int type;
u_short remote_port;
- IPAddress local_addr;
+ IpAddress local_addr;
unsigned char tos;
int sock_family;
char ipaddr[MAX_IPSTRLEN]; /* dotted decimal address of peer */
halfClosedReader = NULL;
// XXX: the following memset may corrupt or leak new or changed members
memset(this, 0, sizeof(fde));
- local_addr.SetEmpty(); // IPAddress likes to be setup nicely.
+ local_addr.SetEmpty(); // IpAddress likes to be setup nicely.
}
};
int ctimeout;
int ftimeout = Config.Timeout.forward - (squid_curtime - start_t);
- IPAddress outgoing;
+ IpAddress outgoing;
unsigned short tos;
- IPAddress client_addr;
+ IpAddress client_addr;
assert(fs);
assert(server_fd == -1);
debugs(17, 3, "fwdConnectStart: " << url);
if (!fs->_peer && request->flags.spoof_client_ip) {
// try to set the outgoing address using TPROXY v2
// if it fails we abort any further TPROXY actions on this connection
- if (IpInterceptor.SetTproxy2OutgoingAddr(int fd, const IPAddress &src) == -1) {
+ if (IpInterceptor.SetTproxy2OutgoingAddr(int fd, const IpAddress &src) == -1) {
request->flags.spoof_client_ip = 0;
}
}
* \item address of the client for which we made the connection
*/
void
-FwdState::pconnPush(int fd, const peer *_peer, const HttpRequest *req, const char *domain, IPAddress &client_addr)
+FwdState::pconnPush(int fd, const peer *_peer, const HttpRequest *req, const char *domain, IpAddress &client_addr)
{
if (_peer) {
fwdPconnPool->push(fd, _peer->name, _peer->http_port, domain, client_addr);
memFree(fs, MEM_FWD_SERVER);
}
-static IPAddress
+static IpAddress
aclMapAddr(acl_address * head, ACLChecklist * ch)
{
acl_address *l;
- IPAddress addr;
+ IpAddress addr;
for (l = head; l; l = l->next) {
if (ch->matchAclListFast(l->aclList))
return 0;
}
-IPAddress
+IpAddress
getOutgoingAddr(HttpRequest * request, struct peer *dst_peer)
{
ACLChecklist ch;
class HttpRequest;
#include "comm.h"
-#include "IPAddress.h"
+#include "ip/IpAddress.h"
class FwdServer
{
bool checkRetry();
bool checkRetriable();
void dispatch();
- void pconnPush(int fd, const peer *_peer, const HttpRequest *req, const char *domain, IPAddress &client_addr);
+ void pconnPush(int fd, const peer *_peer, const HttpRequest *req, const char *domain, IpAddress &client_addr);
bool dontRetry() { return flags.dont_retry; }
unsigned int forward_completed:1;
} flags;
- IPAddress src; /* Client address for this connection. Needed for transparent operations. */
+ IpAddress src; /* Client address for this connection. Needed for transparent operations. */
};
#endif
* and does not affect the FQDN cache.
*/
void
-fqdncache_nbgethostbyaddr(IPAddress &addr, FQDNH * handler, void *handlerData)
+fqdncache_nbgethostbyaddr(IpAddress &addr, FQDNH * handler, void *handlerData)
{
fqdncache_entry *f = NULL;
char name[MAX_IPSTRLEN];
*
*/
const char *
-fqdncache_gethostbyaddr(IPAddress &addr, int flags)
+fqdncache_gethostbyaddr(IpAddress &addr, int flags)
{
char name[MAX_IPSTRLEN];
fqdncache_entry *f = NULL;
/// \ingroup FQDNCacheAPI
const char *
-fqdnFromAddr(IPAddress &addr)
+fqdnFromAddr(IpAddress &addr)
{
const char *n;
static char buf[MAX_IPSTRLEN];
char h1, h2, h3, h4;
int n;
u_short port;
- IPAddress ipa_remote;
+ IpAddress ipa_remote;
int fd = ftpState->data.fd;
char *buf;
debugs(9, 3, HERE);
static void
ftpSendPassive(FtpStateData * ftpState)
{
- IPAddress addr;
+ IpAddress addr;
struct addrinfo *AI = NULL;
/** Checks the server control channel is still available before running. */
int p1, p2;
int n;
u_short port;
- IPAddress ipa_remote;
+ IpAddress ipa_remote;
int fd = ftpState->data.fd;
char *buf;
LOCAL_ARRAY(char, ipaddr, 1024);
{
int fd;
- IPAddress addr;
+ IpAddress addr;
struct addrinfo *AI = NULL;
int on = 1;
int x = 0;
{
int fd;
- IPAddress ipa;
+ IpAddress ipa;
struct addrinfo *AI = NULL;
unsigned char *addrptr;
unsigned char *portptr;
ftpSendEPRT(FtpStateData * ftpState)
{
int fd;
- IPAddress addr;
+ IpAddress addr;
struct addrinfo *AI = NULL;
char buf[MAX_IPSTRLEN];
extern struct acl_deny_info_list *DenyInfoList; /* NULL */
-//MOVED:icp_v2.cc extern IPAddress theOutICPAddr;
-//MOVED:snmp_core.cc extern IPAddress theOutSNMPAddr;
+//MOVED:icp_v2.cc extern IpAddress theOutICPAddr;
+//MOVED:snmp_core.cc extern IpAddress theOutSNMPAddr;
extern struct timeval squid_start;
extern int shutting_down; /* 0 */
-
/*
- * $Id: helper.h,v 1.12 2008/02/26 21:49:34 amosjeffries Exp $
- *
* DEBUG: section 84 Helper process maintenance
* AUTHOR: Harvest Derived?
*
#include "squid.h"
#include "cbdata.h"
-#include "IPAddress.h"
+#include "ip/IpAddress.h"
class helper_request;
int n_running;
int n_active;
int ipc_type;
- IPAddress addr;
+ IpAddress addr;
unsigned int concurrency;
time_t last_queue_warn;
time_t last_restart;
int n_running;
int n_active;
int ipc_type;
- IPAddress addr;
+ IpAddress addr;
MemAllocator *datapool;
HLPSAVAIL *IsAvailable;
HLPSONEQ *OnEmptyQueue;
struct _helper_server {
int index;
int pid;
- IPAddress addr;
+ IpAddress addr;
int rfd;
int wfd;
MemBuf *wqueue;
struct _helper_stateful_server {
int index;
int pid;
- IPAddress addr;
+ IpAddress addr;
int rfd;
int wfd;
/* MemBuf wqueue; */
void checkHit();
void checkedHit(StoreEntry *e);
- void setFrom (IPAddress &from);
+ void setFrom (IpAddress &from);
void setDataHeader (htcpDataHeader *);
char *method;
char *uri;
private:
HttpRequest *checkHitRequest;
- IPAddress from; // was a ptr. return to such IFF needed. otherwise copy should do.
+ IpAddress from; // was a ptr. return to such IFF needed. otherwise copy should do.
htcpDataHeader *dhdr;
};
static u_int32_t queried_id[N_QUERIED_KEYS];
static cache_key queried_keys[N_QUERIED_KEYS][SQUID_MD5_DIGEST_LENGTH];
-static IPAddress queried_addr[N_QUERIED_KEYS];
+static IpAddress queried_addr[N_QUERIED_KEYS];
static MemAllocator *htcpDetailPool = NULL;
static int old_squid_format = 0;
static void htcpFreeSpecifier(htcpSpecifier * s);
static void htcpFreeDetail(htcpDetail * s);
-static void htcpHandleMsg(char *buf, int sz, IPAddress &from);
+static void htcpHandleMsg(char *buf, int sz, IpAddress &from);
-static void htcpHandleMon(htcpDataHeader *, char *buf, int sz, IPAddress &from);
+static void htcpHandleMon(htcpDataHeader *, char *buf, int sz, IpAddress &from);
-static void htcpHandleNop(htcpDataHeader *, char *buf, int sz, IPAddress &from);
+static void htcpHandleNop(htcpDataHeader *, char *buf, int sz, IpAddress &from);
-static void htcpHandleSet(htcpDataHeader *, char *buf, int sz, IPAddress &from);
+static void htcpHandleSet(htcpDataHeader *, char *buf, int sz, IpAddress &from);
-static void htcpHandleTst(htcpDataHeader *, char *buf, int sz, IPAddress &from);
+static void htcpHandleTst(htcpDataHeader *, char *buf, int sz, IpAddress &from);
static void htcpRecv(int fd, void *data);
-static void htcpSend(const char *buf, int len, IPAddress &to);
+static void htcpSend(const char *buf, int len, IpAddress &to);
-static void htcpTstReply(htcpDataHeader *, StoreEntry *, htcpSpecifier *, IPAddress &);
+static void htcpTstReply(htcpDataHeader *, StoreEntry *, htcpSpecifier *, IpAddress &);
-static void htcpHandleTstRequest(htcpDataHeader *, char *buf, int sz, IPAddress &from);
+static void htcpHandleTstRequest(htcpDataHeader *, char *buf, int sz, IpAddress &from);
-static void htcpHandleTstResponse(htcpDataHeader *, char *, int, IPAddress &);
+static void htcpHandleTstResponse(htcpDataHeader *, char *, int, IpAddress &);
static void
htcpHexdump(const char *tag, const char *s, int sz)
static void
-htcpSend(const char *buf, int len, IPAddress &to)
+htcpSend(const char *buf, int len, IpAddress &to)
{
int x;
void
-htcpSpecifier::setFrom (IPAddress &aSocket)
+htcpSpecifier::setFrom (IpAddress &aSocket)
{
from = aSocket;
}
static int
-htcpAccessCheck(acl_access * acl, htcpSpecifier * s, IPAddress &from)
+htcpAccessCheck(acl_access * acl, htcpSpecifier * s, IpAddress &from)
{
ACLChecklist checklist;
checklist.src_addr = from;
}
static void
-htcpTstReply(htcpDataHeader * dhdr, StoreEntry * e, htcpSpecifier * spec, IPAddress &from)
+htcpTstReply(htcpDataHeader * dhdr, StoreEntry * e, htcpSpecifier * spec, IpAddress &from)
{
htcpStuff stuff;
static char pkt[8192];
static void
-htcpClrReply(htcpDataHeader * dhdr, int purgeSucceeded, IPAddress &from)
+htcpClrReply(htcpDataHeader * dhdr, int purgeSucceeded, IpAddress &from)
{
htcpStuff stuff;
static char pkt[8192];
static void
-htcpHandleNop(htcpDataHeader * hdr, char *buf, int sz, IPAddress &from)
+htcpHandleNop(htcpDataHeader * hdr, char *buf, int sz, IpAddress &from)
{
debugs(31, 3, "htcpHandleNop: Unimplemented");
}
static void
-htcpHandleTst(htcpDataHeader * hdr, char *buf, int sz, IPAddress &from)
+htcpHandleTst(htcpDataHeader * hdr, char *buf, int sz, IpAddress &from)
{
debugs(31, 3, "htcpHandleTst: sz = " << sz);
static void
-htcpHandleTstResponse(htcpDataHeader * hdr, char *buf, int sz, IPAddress &from)
+htcpHandleTstResponse(htcpDataHeader * hdr, char *buf, int sz, IpAddress &from)
{
htcpReplyData htcpReply;
cache_key *key = NULL;
- IPAddress *peer;
+ IpAddress *peer;
htcpDetail *d = NULL;
char *t;
static void
-htcpHandleTstRequest(htcpDataHeader * dhdr, char *buf, int sz, IPAddress &from)
+htcpHandleTstRequest(htcpDataHeader * dhdr, char *buf, int sz, IpAddress &from)
{
/* buf should be a SPECIFIER */
htcpSpecifier *s;
static void
-htcpHandleMon(htcpDataHeader * hdr, char *buf, int sz, IPAddress &from)
+htcpHandleMon(htcpDataHeader * hdr, char *buf, int sz, IpAddress &from)
{
debugs(31, 3, "htcpHandleMon: Unimplemented");
}
static void
-htcpHandleSet(htcpDataHeader * hdr, char *buf, int sz, IPAddress &from)
+htcpHandleSet(htcpDataHeader * hdr, char *buf, int sz, IpAddress &from)
{
debugs(31, 3, "htcpHandleSet: Unimplemented");
}
static void
-htcpHandleClr(htcpDataHeader * hdr, char *buf, int sz, IPAddress &from)
+htcpHandleClr(htcpDataHeader * hdr, char *buf, int sz, IpAddress &from)
{
htcpSpecifier *s;
/* buf[0/1] is reserved and reason */
* hands it off to other functions to break apart message-specific data.
*/
static void
-htcpHandleMsg(char *buf, int sz, IPAddress &from)
+htcpHandleMsg(char *buf, int sz, IpAddress &from)
{
htcpHeader htcpHdr;
htcpDataHeader hdr;
{
static char buf[8192];
int len;
- static IPAddress from;
+ static IpAddress from;
/* Receive up to 8191 bytes, leaving room for a null */
return;
}
- IPAddress incomingAddr = Config.Addrs.udp_incoming;
+ IpAddress incomingAddr = Config.Addrs.udp_incoming;
incomingAddr.SetPort(Config.Port.htcp);
enter_suid();
debugs(31, 1, "Accepting HTCP messages on port " << Config.Port.htcp << ", FD " << htcpInSocket << ".");
if (!Config.Addrs.udp_outgoing.IsNoAddr()) {
- IPAddress outgoingAddr = Config.Addrs.udp_outgoing;
+ IpAddress outgoingAddr = Config.Addrs.udp_outgoing;
outgoingAddr.SetPort(Config.Port.htcp);
enter_suid();
/*
- * $Id: htcp.h,v 1.7 2008/02/26 21:49:35 amosjeffries Exp $
- *
- *
* SQUID Web Proxy Cache http://www.squid-cache.org/
* ----------------------------------------------------------
*
#define SQUID_HTCP_H
#if USE_HTCP
+
#include "HttpHeader.h"
-#include "IPAddress.h"
+
+class IpAddress;
/// \ingroup ServerProtocolHTCP
class HtcpReplyData
typedef class HtcpReplyData htcpReplyData;
/// \ingroup ServerProtocolHTCP
-SQUIDCEXTERN void neighborsHtcpReply(const cache_key *, htcpReplyData *, const IPAddress &);
+SQUIDCEXTERN void neighborsHtcpReply(const cache_key *, htcpReplyData *, const IpAddress &);
/// \ingroup ServerProtocolHTCP
SQUIDCEXTERN void htcpInit(void);
HttpStateData::processReplyBody()
{
AsyncCall::Pointer call;
- IPAddress client_addr;
+ IpAddress client_addr;
bool ispinned = false;
if (!flags.headers_parsed) {
}
void
-Icmp::Log(const IPAddress &addr, const u_int8_t type, const char* pkt_str, const int rtt, const int hops)
+Icmp::Log(const IpAddress &addr, const u_int8_t type, const char* pkt_str, const int rtt, const int hops)
{
debugs(42, 2, "pingerLog: " << std::setw(9) << current_time.tv_sec <<
"." << std::setfill('0') << std::setw(6) <<
/*
- * $Id: ICMP.h,v 1.1 2007/12/14 23:11:45 amosjeffries Exp $
- *
* DEBUG: section 37 ICMP Routines
* AUTHOR: Duane Wessels, Amos Jeffries
*
#define _INCLUDE_ICMP_H
#include "config.h"
-#include "IPAddress.h"
+#include "ip/IpAddress.h"
#define PINGER_PAYLOAD_SZ 8192
/* This is a line-data format struct. DO NOT alter. */
struct pingerEchoData {
- IPAddress to;
+ IpAddress to;
unsigned char opcode;
int psize;
char payload[PINGER_PAYLOAD_SZ];
/* This is a line-data format struct. DO NOT alter. */
struct pingerReplyData {
- IPAddress from;
+ IpAddress from;
unsigned char opcode;
int rtt;
int hops;
* Content longer than MAX_PAYLOAD will be truncated.
\param len Length of the payload in bytes if any is to be sent or 0.
*/
- virtual void SendEcho(IPAddress &to, int opcode, const char *payload=NULL, int len=0) =0;
+ virtual void SendEcho(IpAddress &to, int opcode, const char *payload=NULL, int len=0) =0;
/// Handle ICMP responses.
virtual void Recv(void) =0;
int ipHops(int ttl);
/// Log the packet.
- void Log(const IPAddress &addr, const u_int8_t type, const char* pkt_str, const int rtt, const int hops);
+ void Log(const IpAddress &addr, const u_int8_t type, const char* pkt_str, const int rtt, const int hops);
/* no use wasting memory */
int icmp_sock;
}
void
-Icmp4::SendEcho(IPAddress &to, int opcode, const char *payload, int len)
+Icmp4::SendEcho(IpAddress &to, int opcode, const char *payload, int len)
{
int x;
LOCAL_ARRAY(char, pkt, MAX_PKT4_SZ);
#include "config.h"
#include "Icmp.h"
-#include "IPAddress.h"
#if HAVE_NETINET_IN_SYSTM_H
#include <netinet/in_systm.h>
virtual int Open();
#if USE_ICMP
- virtual void SendEcho(IPAddress &, int, const char*, int);
+ virtual void SendEcho(IpAddress &, int, const char*, int);
virtual void Recv(void);
#endif
};
* Generates an RFC 4443 Icmp6 ECHO Packet and sends into the network.
*/
void
-Icmp6::SendEcho(IPAddress &to, int opcode, const char *payload, int len)
+Icmp6::SendEcho(IpAddress &to, int opcode, const char *payload, int len)
{
int x;
LOCAL_ARRAY(char, pkt, MAX_PKT6_SZ);
/*
- * $Id: ICMPv6.h,v 1.1 2007/12/14 23:11:45 amosjeffries Exp $
- *
* DEBUG: section 37 ICMP Routines
* AUTHOR: Duane Wessels, Amos Jeffries
*
#if USE_IPV6
#include "Icmp.h"
-#include "IPAddress.h"
#if HAVE_NETINET_IN_H
#include <netinet/in.h>
virtual int Open();
#if USE_ICMP
- virtual void SendEcho(IPAddress &, int, const char*, int);
+ virtual void SendEcho(IpAddress &, int, const char*, int);
virtual void Recv(void);
#endif
};
private:
// unused in IcmpPinger
- virtual void SendEcho(IPAddress &to, int opcode, const char *payload, int len) {};
+ virtual void SendEcho(IpAddress &to, int opcode, const char *payload, int len) {};
/**
* Control channel(s) to squid.
#if USE_ICMP
void
-IcmpSquid::SendEcho(IPAddress &to, int opcode, const char *payload, int len)
+IcmpSquid::SendEcho(IpAddress &to, int opcode, const char *payload, int len)
{
static pingerEchoData pecho;
int x, slen;
int n;
static int fail_count = 0;
pingerReplyData preply;
- static IPAddress F;
+ static IpAddress F;
commSetSelect(icmp_sock, COMM_SELECT_READ, icmpSquidRecv, NULL, 0);
memset(&preply, '\0', sizeof(pingerReplyData));
#endif /* USE_ICMP */
void
-IcmpSquid::DomainPing(IPAddress &to, const char *domain)
+IcmpSquid::DomainPing(IpAddress &to, const char *domain)
{
#if USE_ICMP
debugs(37, 4, HERE << "'" << domain << "' (" << to << ")");
const char *args[2];
int rfd;
int wfd;
- IPAddress localhost;
+ IpAddress localhost;
/* User configured disabled. */
if (!Config.pinger.enable) {
/*
- * $Id: ICMPSquid.h,v 1.1 2007/12/14 23:11:45 amosjeffries Exp $
- *
* DEBUG: section 37 ICMP Routines
* AUTHOR: Duane Wessels, Amos Jeffries
*
#include "config.h"
#include "Icmp.h"
-#include "IPAddress.h"
/**
* Implements a non-blocking pseudo-ICMP engine for squid internally.
virtual int Open();
virtual void Close();
- void DomainPing(IPAddress &to, const char *domain);
+ void DomainPing(IpAddress &to, const char *domain);
#if USE_ICMP
- virtual void SendEcho(IPAddress &to, int opcode, const char* payload=NULL, int len=0);
+ virtual void SendEcho(IpAddress &to, int opcode, const char* payload=NULL, int len=0);
virtual void Recv(void);
#endif
};
../globals.cc \
../time.cc \
../SquidConfig.cc \
- ../SquidNew.cc \
- ../ip/stubQosConfig.cc
+ ../SquidNew.cc
pinger_LDFLAGS = $(LIBADD_DL)
pinger_LDADD=\
libicmp-core.la \
+ ../ip/libip.la \
$(top_builddir)/lib/libmiscutil.a
pinger_DEPENDENCIES= \
libicmp-core.la \
@SQUID_CPPUNIT_LIBS@ \
@SQUID_CPPUNIT_LA@ \
libicmp-core.la \
+ ../ip/libip.la \
$(top_builddir)/lib/libmiscutil.a
testIcmp_DEPENDENCIES= @SQUID_CPPUNIT_LA@ \
libicmp-core.la \
/*
- * $Id: net_db.cc,v 1.202 2008/01/07 17:12:28 hno Exp $
- *
* DEBUG: section 38 Network Measurement Database
* AUTHOR: Duane Wessels
*
#include "forward.h"
#include "SquidTime.h"
#include "wordlist.h"
-#include "IPAddress.h"
+#include "ip/IpAddress.h"
#if USE_ICMP
#include "icmp/IcmpSquid.h"
static hash_table *addr_table = NULL;
static hash_table *host_table = NULL;
-IPAddress networkFromInaddr(const IPAddress &a);
+IpAddress networkFromInaddr(const IpAddress &a);
static void netdbRelease(netdbEntry * n);
-static void netdbHashInsert(netdbEntry * n, IPAddress &addr);
+static void netdbHashInsert(netdbEntry * n, IpAddress &addr);
static void netdbHashDelete(const char *key);
static void netdbHostInsert(netdbEntry * n, const char *hostname);
static void netdbHostDelete(const net_db_name * x);
static wordlist *peer_names = NULL;
static void
-netdbHashInsert(netdbEntry * n, IPAddress &addr)
+netdbHashInsert(netdbEntry * n, IpAddress &addr)
{
networkFromInaddr(addr).NtoA(n->network, MAX_IPSTRLEN);
n->hash.key = n->network;
}
static netdbEntry *
-netdbLookupAddr(const IPAddress &addr)
+netdbLookupAddr(const IpAddress &addr)
{
netdbEntry *n;
char *key = new char[MAX_IPSTRLEN];
}
static netdbEntry *
-netdbAdd(IPAddress &addr)
+netdbAdd(IpAddress &addr)
{
netdbEntry *n;
static void
netdbSendPing(const ipcache_addrs * ia, void *data)
{
- IPAddress addr;
+ IpAddress addr;
char *hostname = NULL;
static_cast<generic_cbdata *>(data)->unwrap(&hostname);
netdbEntry *n;
xfree(hostname);
}
-IPAddress
-networkFromInaddr(const IPAddress &in)
+IpAddress
+networkFromInaddr(const IpAddress &in)
{
- IPAddress out;
+ IpAddress out;
out = in;
#if USE_IPV6
netdbEntry *n;
netdbEntry N;
- IPAddress addr;
+ IpAddress addr;
int count = 0;
struct timeval start = current_time;
static void
netdbExchangeHandleReply(void *data, StoreIOBuffer receivedData)
{
- IPAddress addr;
+ IpAddress addr;
netdbExchangeState *ex = (netdbExchangeState *)data;
int rec_sz = 0;
}
void
-netdbHandlePingReply(const IPAddress &from, int hops, int rtt)
+netdbHandlePingReply(const IpAddress &from, int hops, int rtt)
{
#if USE_ICMP
netdbEntry *n;
#if 0 // AYJ: Looks to be unused code.
int
-netdbHops(IPAddress &addr)
+netdbHops(IpAddress &addr)
{
#if USE_ICMP
netdbEntry *n = netdbLookupAddr(addr);
}
void
-netdbExchangeUpdatePeer(IPAddress &addr, peer * e, double rtt, double hops)
+netdbExchangeUpdatePeer(IpAddress &addr, peer * e, double rtt, double hops)
{
#if USE_ICMP
netdbEntry *n;
}
void
-netdbDeleteAddrNetwork(IPAddress &addr)
+netdbDeleteAddrNetwork(IpAddress &addr)
{
#if USE_ICMP
netdbEntry *n = netdbLookupAddr(addr);
HttpReply *reply = new HttpReply;
#if USE_ICMP
- IPAddress addr;
+ IpAddress addr;
netdbEntry *n;
int i;
#include "config.h"
-class IPAddress;
+class IpAddress;
class StoreEntry;
class HttpRequest;
SQUIDCEXTERN void netdbInit(void);
-SQUIDCEXTERN void netdbHandlePingReply(const IPAddress &from, int hops, int rtt);
+SQUIDCEXTERN void netdbHandlePingReply(const IpAddress &from, int hops, int rtt);
SQUIDCEXTERN void netdbPingSite(const char *hostname);
SQUIDCEXTERN void netdbDump(StoreEntry *);
#if 0 // AYJ: Looks to be unused now.
-SQUIDCEXTERN int netdbHops(IPAddress &);
+SQUIDCEXTERN int netdbHops(IpAddress &);
#endif
SQUIDCEXTERN void netdbFreeMemory(void);
SQUIDCEXTERN int netdbHostRtt(const char *host);
SQUIDCEXTERN void netdbUpdatePeer(HttpRequest *, peer * e, int rtt, int hops);
-SQUIDCEXTERN void netdbDeleteAddrNetwork(IPAddress &addr);
+SQUIDCEXTERN void netdbDeleteAddrNetwork(IpAddress &addr);
SQUIDCEXTERN void netdbBinaryExchange(StoreEntry *);
SQUIDCEXTERN void netdbExchangeStart(void *);
-SQUIDCEXTERN void netdbExchangeUpdatePeer(IPAddress &, peer *, double, double);
+SQUIDCEXTERN void netdbExchangeUpdatePeer(IpAddress &, peer *, double, double);
SQUIDCEXTERN peer *netdbClosestParent(HttpRequest *);
SQUIDCEXTERN void netdbHostData(const char *host, int *samp, int *rtt, int *hops);
virtual void Close() {};
/// Construct ECHO request
- virtual void SendEcho(IPAddress &to, int opcode, const char *payload, int len) {};
+ virtual void SendEcho(IpAddress &to, int opcode, const char *payload, int len) {};
/// Handle ICMP responses.
virtual void Recv(void) {};
/*
- * $Id: icp_v2.cc,v 1.103 2008/02/26 21:49:35 amosjeffries Exp $
- *
* DEBUG: section 12 Internet Cache Protocol (ICP)
* AUTHOR: Duane Wessels
*
#include "wordlist.h"
#include "SquidTime.h"
#include "SwapDir.h"
-#include "IPAddress.h"
#include "icmp/net_db.h"
+#include "ip/IpAddress.h"
/// \ingroup ServerProtocolICPInternal2
-static void icpLogIcp(const IPAddress &, log_type, int, const char *, int);
+static void icpLogIcp(const IpAddress &, log_type, int, const char *, int);
/// \ingroup ServerProtocolICPInternal2
-static void icpHandleIcpV2(int, IPAddress &, char *, int);
+static void icpHandleIcpV2(int, IpAddress &, char *, int);
/// \ingroup ServerProtocolICPInternal2
static void icpCount(void *, int, size_t, int);
static icpUdpData *IcpQueueTail = NULL;
/// \ingroup ServerProtocolICPInternal2
-IPAddress theOutICPAddr;
+IpAddress theOutICPAddr;
/* icp_common_t */
_icp_common_t::_icp_common_t() : opcode(ICP_INVALID), version(0), length(0), reqnum(0), flags(0), pad(0), shostid(0)
/// \ingroup ServerProtocolICPInternal2
static void
-icpLogIcp(const IPAddress &caddr, log_type logcode, int len, const char *url, int delay)
+icpLogIcp(const IpAddress &caddr, log_type logcode, int len, const char *url, int delay)
{
AccessLogEntry al;
int
icpUdpSend(int fd,
- const IPAddress &to,
+ const IpAddress &to,
icp_common_t * msg,
log_type logcode,
int delay)
}
void
-icpCreateAndSend(icp_opcode opcode, int flags, char const *url, int reqnum, int pad, int fd, const IPAddress &from)
+icpCreateAndSend(icp_opcode opcode, int flags, char const *url, int reqnum, int pad, int fd, const IpAddress &from)
{
icp_common_t *reply = _icp_common_t::createMessage(opcode, flags, url, reqnum, pad);
icpUdpSend(fd, from, reply, icpLogFromICPCode(opcode), 0);
}
void
-icpDenyAccess(IPAddress &from, char *url, int reqnum, int fd)
+icpDenyAccess(IpAddress &from, char *url, int reqnum, int fd)
{
debugs(12, 2, "icpDenyAccess: Access Denied for " << from << " by " << AclMatchedName << ".");
}
int
-icpAccessAllowed(IPAddress &from, HttpRequest * icp_request)
+icpAccessAllowed(IpAddress &from, HttpRequest * icp_request)
{
ACLChecklist checklist;
checklist.src_addr = from;
}
HttpRequest *
-icpGetRequest(char *url, int reqnum, int fd, IPAddress &from)
+icpGetRequest(char *url, int reqnum, int fd, IpAddress &from)
{
if (strpbrk(url, w_space)) {
url = rfc1738_escape(url);
}
static void
-doV2Query(int fd, IPAddress &from, char *buf, icp_common_t header)
+doV2Query(int fd, IpAddress &from, char *buf, icp_common_t header)
{
int rtt = 0;
int src_rtt = 0;
}
void
-_icp_common_t::handleReply(char *buf, IPAddress &from)
+_icp_common_t::handleReply(char *buf, IpAddress &from)
{
if (neighbors_do_private_keys && reqnum == 0) {
debugs(12, 0, "icpHandleIcpV2: Neighbor " << from << " returned reqnum = 0");
}
static void
-icpHandleIcpV2(int fd, IPAddress &from, char *buf, int len)
+icpHandleIcpV2(int fd, IpAddress &from, char *buf, int len)
{
if (len <= 0) {
debugs(12, 3, "icpHandleIcpV2: ICP message is too small");
icpPktDump(icp_common_t * pkt)
{
- IPAddress a;
+ IpAddress a;
debugs(12, 9, "opcode: " << std::setw(3) << pkt->opcode << " " << icp_opcode_str[pkt->opcode]);
debugs(12, 9, "version: "<< std::left << std::setw(8) << pkt->version);
{
int *N = &incoming_sockets_accepted;
- IPAddress from;
+ IpAddress from;
LOCAL_ARRAY(char, buf, SQUID_UDP_SO_RCVBUF);
int len;
int icp_version;
{
u_int16_t port;
- IPAddress addr;
+ IpAddress addr;
struct addrinfo *xai = NULL;
int x;
/// \ingroup ServerProtocolICPInternal3
static void
-doV3Query(int fd, IPAddress &from, char *buf, icp_common_t header)
+doV3Query(int fd, IpAddress &from, char *buf, icp_common_t header)
{
/* We have a valid packet */
char *url = buf + sizeof(icp_common_t) + sizeof(u_int32_t);
/// \ingroup ServerProtocolICPInternal3
/* Currently Harvest cached-2.x uses ICP_VERSION_3 */
void
-icpHandleIcpV3(int fd, IPAddress&from, char *buf, int len)
+icpHandleIcpV3(int fd, IpAddress&from, char *buf, int len)
{
if (len <= 0) {
debugs(12, 3, "icpHandleIcpV3: ICP message is too small");
hash_link hash; /* must be first */
int fd; /* IDENT fd */
- IPAddress me;
+ IpAddress me;
- IPAddress my_peer;
+ IpAddress my_peer;
IdentClient *clients;
char buf[4096];
} IdentStateData;
* start a TCP connection to the peer host on port 113
*/
void
-identStart(IPAddress &me, IPAddress &my_peer, IDCB * callback, void *data)
+identStart(IpAddress &me, IpAddress &my_peer, IDCB * callback, void *data)
{
IdentStateData *state;
int fd;
#include "cbdata.h"
-class IPAddress;
+class IpAddress;
/// \ingroup IdentAPI
-SQUIDCEXTERN void identStart(IPAddress &me, IPAddress &my_peer, IDCB * callback, void *cbdata);
+SQUIDCEXTERN void identStart(IpAddress &me, IpAddress &my_peer, IDCB * callback, void *cbdata);
/// \ingroup IdentAPI
SQUIDCEXTERN void identInit(void);
#if USE_IPV6
/* check for an IP address and format appropriately if found */
- IPAddress test = lc_host;
+ IpAddress test = lc_host;
if ( !test.IsAnyAddr() ) {
test.ToHostname(lc_host,SQUIDHOSTNAMELEN);
}
/*
- * $Id: IPAddress.cc,v 1.4 2008/02/15 09:45:57 amosjeffries Exp $
- *
* DEBUG: section 14 IP Storage and Handling
* AUTHOR: Amos Jeffries
*
* developed and/or copyrighted by other sources. Please see the
* CREDITS file for full details.
*
- * This IPAddress code is copyright (C) 2007 by Treehouse Networks Ltd
+ * This IpAddress code is copyright (C) 2007 by Treehouse Networks Ltd
* of New Zealand. It is published and Lisenced as an extension of
* squid under the same conditions as the main squid application.
*
*/
#include "config.h"
-#include "IPAddress.h"
+#include "ip/IpAddress.h"
#include "util.h"
#ifndef SQUID_DEBUG
# define debugs(a,b,c) // drop.
#else
-#warning "IPAddress built with Debugs!!"
+#warning "IpAddress built with Debugs!!"
# include "../src/Debug.h"
#endif
#if USE_IPV6
#define IASSERT(a,b) \
if(!(b)){ printf("assert \"%s\" at line %d\n", a, __LINE__); \
- printf("IPAddress invalid? with IsIPv4()=%c, IsIPv6()=%c\n",(IsIPv4()?'T':'F'),(IsIPv6()?'T':'F')); \
+ printf("IpAddress invalid? with IsIPv4()=%c, IsIPv6()=%c\n",(IsIPv4()?'T':'F'),(IsIPv6()?'T':'F')); \
printf("ADDRESS:"); \
for(unsigned int i = 0; i < sizeof(m_SocketAddr.sin6_addr); i++) { \
printf(" %x", m_SocketAddr.sin6_addr.s6_addr[i]); \
#else
#define IASSERT(a,b) \
if(!(b)){ printf("assert \"%s\" at line %d\n", a, __LINE__); \
- printf("IPAddress invalid? with IsIPv4()=%c, IsIPv6()=%c\n",(IsIPv4()?'T':'F'),(IsIPv6()?'T':'F')); \
+ printf("IpAddress invalid? with IsIPv4()=%c, IsIPv6()=%c\n",(IsIPv4()?'T':'F'),(IsIPv6()?'T':'F')); \
printf("ADDRESS: %x\n", (unsigned int)m_SocketAddr.sin_addr.s_addr); \
assert(b); \
}
#endif
-IPAddress::IPAddress()
+IpAddress::IpAddress()
{
SetEmpty();
}
-IPAddress::~IPAddress()
+IpAddress::~IpAddress()
{
- memset(this,0,sizeof(IPAddress));
+ memset(this,0,sizeof(IpAddress));
}
int
-IPAddress::GetCIDR() const
+IpAddress::GetCIDR() const
{
uint8_t shift,byte;
uint8_t bit,caught;
return len;
}
-const int IPAddress::ApplyMask(IPAddress const &mask_addr)
+const int IpAddress::ApplyMask(IpAddress const &mask_addr)
{
uint32_t *p1 = (uint32_t*)(&m_SocketAddr.sin6_addr);
uint32_t const *p2 = (uint32_t const *)(&mask_addr.m_SocketAddr.sin6_addr);
return changes;
}
-bool IPAddress::ApplyMask(const unsigned int cidr, int mtype)
+bool IpAddress::ApplyMask(const unsigned int cidr, int mtype)
{
uint8_t clearbits = 0;
uint8_t* p = NULL;
return true;
}
-bool IPAddress::IsSockAddr() const
+bool IpAddress::IsSockAddr() const
{
return (m_SocketAddr.sin6_port != 0);
}
-bool IPAddress::IsIPv4() const
+bool IpAddress::IsIPv4() const
{
#if USE_IPV6
#endif
}
-bool IPAddress::IsIPv6() const
+bool IpAddress::IsIPv6() const
{
#if USE_IPV6
#endif
}
-bool IPAddress::IsAnyAddr() const
+bool IpAddress::IsAnyAddr() const
{
#if USE_IPV6
return m_SocketAddr.sin6_addr.s6_addr32[0] == 0
}
/// NOTE: Does NOT clear the Port stored. Ony the Address and Type.
-void IPAddress::SetAnyAddr()
+void IpAddress::SetAnyAddr()
{
#if USE_IPV6
memset(&m_SocketAddr.sin6_addr, 0, sizeof(struct in6_addr) );
#endif
}
-/// NOTE: completely empties the IPAddress structure. Address, Port, Type, everything.
-void IPAddress::SetEmpty()
+/// NOTE: completely empties the IpAddress structure. Address, Port, Type, everything.
+void IpAddress::SetEmpty()
{
memset(&m_SocketAddr, 0, sizeof(m_SocketAddr) );
}
-bool IPAddress::SetIPv4()
+bool IpAddress::SetIPv4()
{
#if USE_IPV6
#endif
}
-bool IPAddress::IsLocalhost() const
+bool IpAddress::IsLocalhost() const
{
#if USE_IPV6
return ( m_SocketAddr.sin6_addr.s6_addr32[0] == 0
#endif
}
-void IPAddress::SetLocalhost()
+void IpAddress::SetLocalhost()
{
#if USE_IPV6
SetAnyAddr();
#endif
}
-bool IPAddress::IsNoAddr() const
+bool IpAddress::IsNoAddr() const
{
// IFF the address == 0xff..ff (all ones)
#if USE_IPV6
#endif
}
-void IPAddress::SetNoAddr()
+void IpAddress::SetNoAddr()
{
#if USE_IPV6
memset(&m_SocketAddr.sin6_addr, 0xFFFFFFFF, sizeof(struct in6_addr) );
#if USE_IPV6
-bool IPAddress::GetReverseString6(char buf[MAX_IPSTRLEN], const struct in6_addr &dat) const
+bool IpAddress::GetReverseString6(char buf[MAX_IPSTRLEN], const struct in6_addr &dat) const
{
char *p = buf;
unsigned char const *r = dat.s6_addr;
#endif
-bool IPAddress::GetReverseString4(char buf[MAX_IPSTRLEN], const struct in_addr &dat) const
+bool IpAddress::GetReverseString4(char buf[MAX_IPSTRLEN], const struct in_addr &dat) const
{
unsigned int i = (unsigned int) ntohl(dat.s_addr);
snprintf(buf, 32, "%u.%u.%u.%u.in-addr.arpa.",
return true;
}
-bool IPAddress::GetReverseString(char buf[MAX_IPSTRLEN], int show_type) const
+bool IpAddress::GetReverseString(char buf[MAX_IPSTRLEN], int show_type) const
{
if (show_type == AF_UNSPEC) {
return false;
}
-IPAddress& IPAddress::operator =(const IPAddress &s)
+IpAddress& IpAddress::operator =(const IpAddress &s)
{
- memcpy(this, &s, sizeof(IPAddress));
+ memcpy(this, &s, sizeof(IpAddress));
return *this;
};
-IPAddress::IPAddress(const char*s)
+IpAddress::IpAddress(const char*s)
{
SetEmpty();
operator=(s);
}
-bool IPAddress::operator =(const char* s)
+bool IpAddress::operator =(const char* s)
{
return LookupHostIP(s, true);
}
-bool IPAddress::GetHostByName(const char* s)
+bool IpAddress::GetHostByName(const char* s)
{
return LookupHostIP(s, false);
}
-bool IPAddress::LookupHostIP(const char *s, bool nodns)
+bool IpAddress::LookupHostIP(const char *s, bool nodns)
{
int err = 0;
return true;
}
-IPAddress::IPAddress(struct sockaddr_in const &s)
+IpAddress::IpAddress(struct sockaddr_in const &s)
{
SetEmpty();
operator=(s);
};
-IPAddress& IPAddress::operator =(struct sockaddr_in const &s)
+IpAddress& IpAddress::operator =(struct sockaddr_in const &s)
{
#if USE_IPV6
Map4to6((const in_addr)s.sin_addr, m_SocketAddr.sin6_addr);
return *this;
};
-IPAddress& IPAddress::operator =(const struct sockaddr_storage &s)
+IpAddress& IpAddress::operator =(const struct sockaddr_storage &s)
{
#if USE_IPV6
/* some AF_* magic to tell socket types apart and what we need to do */
return *this;
};
-void IPAddress::check4Mapped()
+void IpAddress::check4Mapped()
{
// obsolete.
// TODO use this NOW to set the sin6_family properly on exporting. not on import.
}
#if USE_IPV6
-IPAddress::IPAddress(struct sockaddr_in6 const &s)
+IpAddress::IpAddress(struct sockaddr_in6 const &s)
{
SetEmpty();
operator=(s);
};
-IPAddress& IPAddress::operator =(struct sockaddr_in6 const &s)
+IpAddress& IpAddress::operator =(struct sockaddr_in6 const &s)
{
memcpy(&m_SocketAddr, &s, sizeof(struct sockaddr_in6));
#endif
-IPAddress::IPAddress(struct in_addr const &s)
+IpAddress::IpAddress(struct in_addr const &s)
{
SetEmpty();
operator=(s);
};
-IPAddress& IPAddress::operator =(struct in_addr const &s)
+IpAddress& IpAddress::operator =(struct in_addr const &s)
{
#if USE_IPV6
Map4to6((const in_addr)s, m_SocketAddr.sin6_addr);
#if USE_IPV6
-IPAddress::IPAddress(struct in6_addr const &s)
+IpAddress::IpAddress(struct in6_addr const &s)
{
SetEmpty();
operator=(s);
};
-IPAddress& IPAddress::operator =(struct in6_addr const &s)
+IpAddress& IpAddress::operator =(struct in6_addr const &s)
{
memcpy(&m_SocketAddr.sin6_addr, &s, sizeof(struct in6_addr));
#endif
-IPAddress::IPAddress(const IPAddress &s)
+IpAddress::IpAddress(const IpAddress &s)
{
SetEmpty();
operator=(s);
}
-IPAddress::IPAddress(IPAddress *s)
+IpAddress::IpAddress(IpAddress *s)
{
SetEmpty();
operator=(s);
}
-IPAddress& IPAddress::operator =(IPAddress *s)
+IpAddress& IpAddress::operator =(IpAddress *s)
{
- IPAddress *tmp = NULL;
+ IpAddress *tmp = NULL;
if (!s) return *this;
- tmp = dynamic_cast<IPAddress*>(s);
+ tmp = dynamic_cast<IpAddress*>(s);
if (!tmp) return *this;
return operator=(*tmp);
}
-IPAddress::IPAddress(const struct hostent &s)
+IpAddress::IpAddress(const struct hostent &s)
{
SetEmpty();
operator=(s);
}
-bool IPAddress::operator =(const struct hostent &s)
+bool IpAddress::operator =(const struct hostent &s)
{
struct in_addr* ipv4 = NULL;
return true;
}
-IPAddress::IPAddress(const struct addrinfo &s)
+IpAddress::IpAddress(const struct addrinfo &s)
{
SetEmpty();
operator=(s);
}
-bool IPAddress::operator =(const struct addrinfo &s)
+bool IpAddress::operator =(const struct addrinfo &s)
{
struct sockaddr_in* ipv4 = NULL;
return true;
}
-void IPAddress::GetAddrInfo(struct addrinfo *&dst, int force) const
+void IpAddress::GetAddrInfo(struct addrinfo *&dst, int force) const
{
if (dst == NULL) {
dst = new addrinfo;
}
}
-void IPAddress::InitAddrInfo(struct addrinfo *&ai) const
+void IpAddress::InitAddrInfo(struct addrinfo *&ai) const
{
if (ai == NULL) {
ai = new addrinfo;
}
-void IPAddress::FreeAddrInfo(struct addrinfo *&ai) const
+void IpAddress::FreeAddrInfo(struct addrinfo *&ai) const
{
if (ai == NULL) return;
ai = NULL;
}
-int IPAddress::matchIPAddr(const IPAddress &rhs) const
+int IpAddress::matchIPAddr(const IpAddress &rhs) const
{
#if USE_IPV6
uint8_t *l = (uint8_t*)m_SocketAddr.sin6_addr.s6_addr;
return 0;
}
-bool IPAddress::operator ==(const IPAddress &s) const
+bool IpAddress::operator ==(const IpAddress &s) const
{
return (0 == matchIPAddr(s));
}
-bool IPAddress::operator !=(const IPAddress &s) const
+bool IpAddress::operator !=(const IpAddress &s) const
{
return ! ( operator==(s) );
}
-bool IPAddress::operator <=(const IPAddress &rhs) const
+bool IpAddress::operator <=(const IpAddress &rhs) const
{
if (IsAnyAddr() && !rhs.IsAnyAddr())
return true;
return (matchIPAddr(rhs) <= 0);
}
-bool IPAddress::operator >=(const IPAddress &rhs) const
+bool IpAddress::operator >=(const IpAddress &rhs) const
{
if (IsNoAddr() && !rhs.IsNoAddr())
return true;
return ( matchIPAddr(rhs) >= 0);
}
-bool IPAddress::operator >(const IPAddress &rhs) const
+bool IpAddress::operator >(const IpAddress &rhs) const
{
if (IsNoAddr() && !rhs.IsNoAddr())
return true;
return ( matchIPAddr(rhs) > 0);
}
-bool IPAddress::operator <(const IPAddress &rhs) const
+bool IpAddress::operator <(const IpAddress &rhs) const
{
if (IsNoAddr() && !rhs.IsNoAddr())
return true;
return ( matchIPAddr(rhs) < 0);
}
-u_short IPAddress::GetPort() const
+u_short IpAddress::GetPort() const
{
return ntohs( m_SocketAddr.sin6_port );
}
-u_short IPAddress::SetPort(u_short prt)
+u_short IpAddress::SetPort(u_short prt)
{
m_SocketAddr.sin6_port = htons(prt);
*
* A copy of the buffer is also returned for simple immediate display.
*/
-char* IPAddress::NtoA(char* buf, const unsigned int blen, int force) const
+char* IpAddress::NtoA(char* buf, const unsigned int blen, int force) const
{
// Ensure we have a buffer.
if (buf == NULL) {
return buf;
}
-unsigned int IPAddress::ToHostname(char *buf, const unsigned int blen) const {
+unsigned int IpAddress::ToHostname(char *buf, const unsigned int blen) const {
char *p = buf;
if (IsIPv6() && blen > 0) {
return (p - buf);
}
-char* IPAddress::ToURL(char* buf, unsigned int blen) const {
+char* IpAddress::ToURL(char* buf, unsigned int blen) const {
char *p = buf;
// Ensure we have a buffer.
return buf;
}
-void IPAddress::GetSockAddr(struct sockaddr_storage &addr, const int family) const {
+void IpAddress::GetSockAddr(struct sockaddr_storage &addr, const int family) const {
struct sockaddr_in *sin = NULL;
if ( family == AF_INET && !IsIPv4()) {
// FIXME INET6: caller using the wrong socket type!
- debugs(14, DBG_CRITICAL, HERE << "IPAddress::GetSockAddr : Cannot convert non-IPv4 to IPv4. from " << *this);
+ debugs(14, DBG_CRITICAL, HERE << "IpAddress::GetSockAddr : Cannot convert non-IPv4 to IPv4. from " << *this);
assert(false);
}
#endif /* USE_IPV6 */
}
-void IPAddress::GetSockAddr(struct sockaddr_in &buf) const {
+void IpAddress::GetSockAddr(struct sockaddr_in &buf) const {
#if USE_IPV6
if ( IsIPv4() ) {
buf.sin_port = m_SocketAddr.sin6_port;
Map6to4( m_SocketAddr.sin6_addr, buf.sin_addr);
} else {
- debugs(14, DBG_CRITICAL, HERE << "IPAddress::GetSockAddr : Cannot convert non-IPv4 to IPv4. from " << *this );
+ debugs(14, DBG_CRITICAL, HERE << "IpAddress::GetSockAddr : Cannot convert non-IPv4 to IPv4. from " << *this );
memset(&buf,0xFFFFFFFF,sizeof(struct sockaddr_in));
assert(false);
#if USE_IPV6
-void IPAddress::GetSockAddr(struct sockaddr_in6 &buf) const {
+void IpAddress::GetSockAddr(struct sockaddr_in6 &buf) const {
memcpy(&buf, &m_SocketAddr, sizeof(struct sockaddr_in6));
/* maintain address family. It may have changed inside us. */
buf.sin6_family = AF_INET6;
#if USE_IPV6
-void IPAddress::Map4to6(const struct in_addr &in, struct in6_addr &out) const {
+void IpAddress::Map4to6(const struct in_addr &in, struct in6_addr &out) const {
/* check for special cases */
if ( in.s_addr == 0x00000000) {
}
}
-void IPAddress::Map6to4(const struct in6_addr &in, struct in_addr &out) const {
+void IpAddress::Map6to4(const struct in6_addr &in, struct in_addr &out) const {
/* ANYADDR */
/* NOADDR */
/* general */
#endif
#if USE_IPV6
-void IPAddress::GetInAddr(in6_addr &buf) const {
+void IpAddress::GetInAddr(in6_addr &buf) const {
memcpy(&buf, &m_SocketAddr.sin6_addr, sizeof(struct in6_addr));
}
#endif
-bool IPAddress::GetInAddr(struct in_addr &buf) const {
+bool IpAddress::GetInAddr(struct in_addr &buf) const {
#if USE_IPV6
if ( IsIPv4() ) {
// default:
// non-compatible IPv6 Pure Address
- debugs(14,1, HERE << "IPAddress::GetInAddr : Cannot convert non-IPv4 to IPv4. IPA=" << *this);
+ debugs(14,1, HERE << "IpAddress::GetInAddr : Cannot convert non-IPv4 to IPv4. IPA=" << *this);
memset(&buf,0xFFFFFFFF,sizeof(struct in_addr));
assert(false);
return false;
/*
- * $Id: IPAddress.h,v 1.3 2008/02/05 22:39:42 amosjeffries Exp $
- *
* DEBUG: section 14 IP Storage and Handling
* AUTHOR: Amos Jeffries
*
* developed and/or copyrighted by other sources. Please see the
* CREDITS file for full details.
*
- * This IPAddress code is copyright (C) 2007 by Treehouse Networks Ltd
+ * This IpAddress code is copyright (C) 2007 by Treehouse Networks Ltd
* of New Zealand. It is published and Lisenced as an extension of
* squid under the same conditions as the main squid application.
*
/**
* Holds and manipulates IPv4, IPv6, and Socket Addresses.
*/
-class IPAddress
+class IpAddress
{
public:
/** @name Constructors and Destructor */
/*@{*/
- IPAddress();
- IPAddress(const IPAddress &);
+ IpAddress();
+ IpAddress(const IpAddress &);
/**
* This constructor takes its own copy of the object pointed to for memory-safe usage later.
\deprecated Use of pointers can be nasty. Consider this a last-resort.
* Prefer the by-reference (&) version instead.
*/
- IPAddress(IPAddress *);
+ IpAddress(IpAddress *);
- IPAddress(const struct in_addr &);
+ IpAddress(const struct in_addr &);
- IPAddress(const struct sockaddr_in &);
+ IpAddress(const struct sockaddr_in &);
#if USE_IPV6
- IPAddress(const struct in6_addr &);
+ IpAddress(const struct in6_addr &);
- IPAddress(const struct sockaddr_in6 &);
+ IpAddress(const struct sockaddr_in6 &);
#endif
- IPAddress(const struct hostent &);
- IPAddress(const struct addrinfo &);
- IPAddress(const char*);
+ IpAddress(const struct hostent &);
+ IpAddress(const struct addrinfo &);
+ IpAddress(const char*);
/// Default destructor.
- ~IPAddress();
+ ~IpAddress();
/*@}*/
/** @name Assignment Operators */
/*@{*/
- IPAddress& operator =(const IPAddress &s);
- IPAddress& operator =(IPAddress *s);
- IPAddress& operator =(struct sockaddr_in const &s);
- IPAddress& operator =(struct sockaddr_storage const &s);
- IPAddress& operator =(struct in_addr const &s);
+ IpAddress& operator =(const IpAddress &s);
+ IpAddress& operator =(IpAddress *s);
+ IpAddress& operator =(struct sockaddr_in const &s);
+ IpAddress& operator =(struct sockaddr_storage const &s);
+ IpAddress& operator =(struct in_addr const &s);
#if USE_IPV6
- IPAddress& operator =(struct in6_addr const &s);
- IPAddress& operator =(struct sockaddr_in6 const &s);
+ IpAddress& operator =(struct in6_addr const &s);
+ IpAddress& operator =(struct sockaddr_in6 const &s);
#endif
bool operator =(const struct hostent &s);
bool operator =(const struct addrinfo &s);
/** @name Boolean Operators */
/*@{*/
- bool operator ==(IPAddress const &s) const;
- bool operator !=(IPAddress const &s) const;
- bool operator >=(IPAddress const &rhs) const;
- bool operator <=(IPAddress const &rhs) const;
- bool operator >(IPAddress const &rhs) const;
- bool operator <(IPAddress const &rhs) const;
+ bool operator ==(IpAddress const &s) const;
+ bool operator !=(IpAddress const &s) const;
+ bool operator >=(IpAddress const &rhs) const;
+ bool operator <=(IpAddress const &rhs) const;
+ bool operator >(IpAddress const &rhs) const;
+ bool operator <(IpAddress const &rhs) const;
public:
/* methods */
bool IsSockAddr() const;
/** Content-neutral test for whether the specific IP case ANY_ADDR is stored.
- * This is the default content of a new undefined IPAddress object.
+ * This is the default content of a new undefined IpAddress object.
\retval true IPv4 0.0.0.0
\retval true IPv6 ::
\retval false anything else.
bool IsNoAddr() const;
/** Content-neutral test for whether the specific IP case LOCALHOST is stored.
- * This is the default content of a new undefined IPAddress object.
+ * This is the default content of a new undefined IpAddress object.
\retval true IPv4 127.0.0.1
\retval true IPv6 ::1
\retval false anything else.
/** Apply a mask to the stored address.
\param mask Netmask format to be bit-mask-AND'd over the stored address.
*/
- const int ApplyMask(const IPAddress &mask);
+ const int ApplyMask(const IpAddress &mask);
/** Apply a mask to the stored address.
* CIDR will be converted appropriate to map the stored content.
\retval 1 IP rhs is greater (numerically) than that stored.
\retval -1 IP rhs is less (numerically) than that stored.
*/
- int matchIPAddr(const IPAddress &rhs) const;
+ int matchIPAddr(const IpAddress &rhs) const;
/**
- * Get RFC 3493 addrinfo structure from the IPAddress data
+ * Get RFC 3493 addrinfo structure from the IpAddress data
* for protocol-neutral socket operations.
* Should be passed a NULL pointer of type struct addrinfo* it will
* allocate memory for the structures involved. (see FreeAddrInfo to clear).
* Some situations may also require an actual call to the system getaddrinfo()
* to pull relevant OS details for the socket.
\par
- * IPAddress allocated objects MUST be destructed by IPAddress::FreeAddrInfo
+ * IpAddress allocated objects MUST be destructed by IpAddress::FreeAddrInfo
* System getaddrinfo() allocated objects MUST be freed with system freeaddrinfo()
\par
* Some OS require that IPv4 addresses are pre-mapped by the client.
#endif
/**
- * Equivalent to the sysem call freeaddrinfo() but for IPAddress allocated data
+ * Equivalent to the sysem call freeaddrinfo() but for IpAddress allocated data
*/
void FreeAddrInfo(struct addrinfo *&ai) const;
void GetSockAddr(struct sockaddr_storage &addr, const int family) const;
- /// \deprecated Deprecated for public use. Use IPAddress::GetAddrInfo()
+ /// \deprecated Deprecated for public use. Use IpAddress::GetAddrInfo()
void GetSockAddr(struct sockaddr_in &) const;
- /// \deprecated Deprecated for public use. Use IPAddress::GetAddrInfo()
+ /// \deprecated Deprecated for public use. Use IpAddress::GetAddrInfo()
bool GetInAddr(struct in_addr &) const; /* false if could not convert IPv6 down to IPv4 */
#if USE_IPV6
- /// \deprecated Deprecated for public use. Use IPAddress::GetAddrInfo()
+ /// \deprecated Deprecated for public use. Use IpAddress::GetAddrInfo()
void GetSockAddr(struct sockaddr_in6 &) const;
- /// \deprecated Deprecated for public use. Use IPAddress::GetAddrInfo()
+ /// \deprecated Deprecated for public use. Use IpAddress::GetAddrInfo()
void GetInAddr(struct in6_addr &) const;
#endif
inline std::ostream &
-operator << (std::ostream &os, const IPAddress &ipa)
+operator << (std::ostream &os, const IpAddress &ipa)
{
char buf[MAX_IPSTRLEN];
os << ipa.ToURL(buf,MAX_IPSTRLEN);
}
// WAS _sockaddr_in_list in an earlier incarnation
-class IPAddress_list
+class IpAddress_list
{
public:
- IPAddress_list() { next = NULL; };
- ~IPAddress_list() { if (next) delete next; next = NULL; };
+ IpAddress_list() { next = NULL; };
+ ~IpAddress_list() { if (next) delete next; next = NULL; };
- IPAddress s;
- IPAddress_list *next;
+ IpAddress s;
+ IpAddress_list *next;
};
}
int
-IpIntercept::NetfilterInterception(int fd, const IPAddress &me, IPAddress &dst, int silent)
+IpIntercept::NetfilterInterception(int fd, const IpAddress &me, IpAddress &dst, int silent)
{
#if LINUX_NETFILTER
struct addrinfo *lookup = NULL;
}
int
-IpIntercept::NetfilterTransparent(int fd, const IPAddress &me, IPAddress &client, int silent)
+IpIntercept::NetfilterTransparent(int fd, const IpAddress &me, IpAddress &client, int silent)
{
#if LINUX_NETFILTER
}
int
-IpIntercept::IpfwInterception(int fd, const IPAddress &me, IPAddress &dst, int silent)
+IpIntercept::IpfwInterception(int fd, const IpAddress &me, IpAddress &dst, int silent)
{
#if IPFW_TRANSPARENT
struct addrinfo *lookup = NULL;
}
int
-IpIntercept::NatLookup(int fd, const IPAddress &me, const IPAddress &peer, IPAddress &client, IPAddress &dst)
+IpIntercept::NatLookup(int fd, const IpAddress &me, const IpAddress &peer, IpAddress &client, IpAddress &dst)
{
#if IPF_TRANSPARENT /* --enable-ipf-transparent */
client = me;
}
#if LINUX_TPROXY2
-IpIntercept::SetTproxy2OutgoingAddr(int fd, const IPAddress &src)
+IpIntercept::SetTproxy2OutgoingAddr(int fd, const IpAddress &src)
{
- IPAddress addr;
+ IpAddress addr;
struct in_tproxy itp;
src.GetInAddr(itp.v.addr.faddr);
#ifndef SQUID_IPINTERCEPTION_H
#define SQUID_IPINTERCEPTION_H
-class IPAddress;
+class IpAddress;
/* for time_t */
#include "SquidTime.h"
~IpIntercept() {};
/** Perform NAT lookups */
- int NatLookup(int fd, const IPAddress &me, const IPAddress &peer, IPAddress &client, IPAddress &dst);
+ int NatLookup(int fd, const IpAddress &me, const IpAddress &peer, IpAddress &client, IpAddress &dst);
#if LINUX_TPROXY2
// only relevant to TPROXY v2 connections.
// which require the address be set specifically post-connect.
- int SetTproxy2OutgoingAddr(int fd, const IPAddress &src);
+ int SetTproxy2OutgoingAddr(int fd, const IpAddress &src);
#endif
/**
\retval 0 Successfuly located the new address.
\retval -1 An error occured during NAT lookups.
*/
- int NetfilterInterception(int fd, const IPAddress &me, IPAddress &client, int silent);
+ int NetfilterInterception(int fd, const IpAddress &me, IpAddress &client, int silent);
/**
* perform Lookups on Netfilter fully-transparent interception targets (TPROXY).
\retval 0 Successfuly located the new address.
\retval -1 An error occured during NAT lookups.
*/
- int NetfilterTransparent(int fd, const IPAddress &me, IPAddress &dst, int silent);
+ int NetfilterTransparent(int fd, const IpAddress &me, IpAddress &dst, int silent);
/**
* perform Lookups on IPFW interception.
\retval 0 Successfuly located the new address.
\retval -1 An error occured during NAT lookups.
*/
- int IpfwInterception(int fd, const IPAddress &me, IPAddress &client, int silent);
+ int IpfwInterception(int fd, const IpAddress &me, IpAddress &client, int silent);
int transparent_active;
# IP Specific Configurations
-#EXTRA_PROGRAMS = \
-# testIcmp
-
noinst_LTLIBRARIES = libip.la
libip_la_SOURCES = \
+ IpAddress.h \
+ IpAddress.cc \
IpIntercept.h \
IpIntercept.cc \
QosConfig.h \
QosConfig.cc
-check_PROGRAMS= testHeaders
+check_PROGRAMS= testHeaders testIpAddress
TESTS= $(check_PROGRAMS)
## Special Universal .h dependency test script
testHeaders.c:
touch testHeaders.c
CLEANFILES += testHeaders.c
+
+
+testIpAddress_SOURCES= \
+ testIpAddress.cc \
+ testIpAddress.h
+nodist_testIpAddress_SOURCES= \
+ ../tests/testMain.cc
+testIpAddress_LDADD= \
+ libip.la \
+ -L$(top_builddir)/lib -lmiscutil \
+ @SQUID_CPPUNIT_LA@ \
+ @SQUID_CPPUNIT_LIBS@
+testIpAddress_LDFLAGS= $(LIBADD_DL)
#if USE_ZPH_QOS
#include "QosConfig.h"
-#include "Store.h"
QosConfig::QosConfig() :
tos_local_hit(0),
}
}
+/**
+ * NOTE: Due to the low-level nature of the library these
+ * objects are part of the dump function must be self-contained.
+ * which means no StoreEntry refrences. Just a basic char* buffer.
+ */
void
-QosConfig::dumpConfigLine(StoreEntry * entry, const char *name) const
+QosConfig::dumpConfigLine(char *entry, const char *name) const
{
- storeAppendPrintf(entry, "%s", name);
+ char *p = entry;
+ snprintf(p, 10, "%s", name); // strlen("qos_flows ");
+ p += strlen(name);
if (tos_local_hit >0) {
- storeAppendPrintf(entry, " local-hit=%2x", tos_local_hit);
+ snprintf(p, 15, " local-hit=%2x", tos_local_hit);
+ p += 15;
}
if (tos_sibling_hit >0) {
- storeAppendPrintf(entry, " sibling-hit=%2x", tos_sibling_hit);
+ snprintf(p, 17, " sibling-hit=%2x", tos_sibling_hit);
+ p += 17;
}
if (tos_parent_hit >0) {
- storeAppendPrintf(entry, " parent-hit=%2x", tos_parent_hit);
+ snprintf(p, 16, " parent-hit=%2x", tos_parent_hit);
+ p += 16;
}
if (preserve_miss_tos != 0) {
- storeAppendPrintf(entry, " disable-preserve-miss");
+ snprintf(p, 22, " disable-preserve-miss");
+ p += 22;
}
if (preserve_miss_tos && preserve_miss_tos_mask != 0) {
- storeAppendPrintf(entry, " miss-mask=%2x", preserve_miss_tos_mask);
+ snprintf(p, 15, " miss-mask=%2x", preserve_miss_tos_mask);
+ p += 15;
}
- storeAppendPrintf(entry, "\n");
+ snprintf(p, 1, "\n");
+// p += 1;
}
#endif /* USE_ZPH_QOS */
#if USE_ZPH_QOS
-class StoreEntry;
-
class QosConfig
{
public:
~QosConfig() {};
void parseConfigLine();
- void dumpConfigLine(StoreEntry *entry, const char *name) const;
+ void dumpConfigLine(char *entry, const char *name) const;
};
/* legacy parser access wrappers */
#define parse_QosConfig(X) (X)->parseConfigLine()
-#define dump_QosConfig(e,n,X) (X).dumpConfigLine(e,n)
#define free_QosConfig(X)
+#define dump_QosConfig(e,n,X) do { \
+ char temp[256]; /* random number. change as needed. max config line length. */ \
+ (X).dumpConfigLine(temp,n); \
+ storeAppendPrintf(e, "%s", temp); \
+ } while(0);
#endif /* USE_ZPH_QOS */
#endif /* SQUID_QOSCONFIG_H */
}
void
-QosConfig::dumpConfigLine(StoreEntry * entry, const char *name) const
+QosConfig::dumpConfigLine(char *entry, const char *name) const
{
; /* Not needed in stub */
}
#include <netdb.h>
#include <string>
-#include "testIPAddress.h"
-#include "IPAddress.h"
+#include "testIpAddress.h"
+#include "ip/IpAddress.h"
-CPPUNIT_TEST_SUITE_REGISTRATION( testIPAddress );
+CPPUNIT_TEST_SUITE_REGISTRATION( testIpAddress );
+
+/* so that we don't break POD dependency just for the test */
+struct timeval current_time;
+double current_dtime;
+time_t squid_curtime = 0;
void
-testIPAddress::testDefaults()
+testIpAddress::testDefaults()
{
- IPAddress anIPA;
+ IpAddress anIPA;
/* test stored values */
CPPUNIT_ASSERT( anIPA.IsAnyAddr() );
}
void
-testIPAddress::testInAddrConstructor()
+testIpAddress::testInAddrConstructor()
{
struct in_addr inval;
struct in_addr outval;
inval.s_addr = htonl(0xC0A8640C);
outval.s_addr = htonl(0x00000000);
- IPAddress anIPA(inval);
+ IpAddress anIPA(inval);
/* test stored values */
CPPUNIT_ASSERT( !anIPA.IsAnyAddr() );
#if USE_IPV6
void
-testIPAddress::testInAddr6Constructor()
+testIpAddress::testInAddr6Constructor()
{
struct in6_addr inval;
struct in6_addr outval = IN6ADDR_ANY_INIT;
inval.s6_addr32[2] = htonl(0xFFFFFFFF);
inval.s6_addr32[3] = htonl(0xFFFFFFFF);
- IPAddress anIPA(inval);
+ IpAddress anIPA(inval);
/* test stored values */
CPPUNIT_ASSERT( !anIPA.IsAnyAddr() );
#endif
void
-testIPAddress::testSockAddrConstructor()
+testIpAddress::testSockAddrConstructor()
{
struct sockaddr_in insock;
struct sockaddr_in outsock;
insock.sin_len = sizeof(struct sockaddr_in);
#endif
- IPAddress anIPA((const struct sockaddr_in)insock);
+ IpAddress anIPA((const struct sockaddr_in)insock);
/* test stored values */
CPPUNIT_ASSERT( !anIPA.IsAnyAddr() );
#if USE_IPV6
void
-testIPAddress::testSockAddr6Constructor()
+testIpAddress::testSockAddr6Constructor()
{
struct sockaddr_in6 insock;
struct sockaddr_in6 outsock;
insock.sin6_len = sizeof(struct sockaddr_in6);
#endif
- IPAddress anIPA((const struct sockaddr_in6)insock);
+ IpAddress anIPA((const struct sockaddr_in6)insock);
/* test stored values */
CPPUNIT_ASSERT( !anIPA.IsAnyAddr() );
void
-testIPAddress::testCopyConstructor()
+testIpAddress::testCopyConstructor()
{
struct sockaddr_in insock;
struct sockaddr_in outsock;
insock.sin_len = sizeof(struct sockaddr_in);
#endif
- IPAddress inIPA(insock);
- IPAddress outIPA(inIPA);
+ IpAddress inIPA(insock);
+ IpAddress outIPA(inIPA);
/* test stored values */
}
void
-testIPAddress::testHostentConstructor()
+testIpAddress::testHostentConstructor()
{
struct hostent *hp = NULL;
struct in_addr outval;
hp = gethostbyname("192.168.100.12");
CPPUNIT_ASSERT( hp != NULL /* gethostbyname failure.*/ );
- IPAddress anIPA(*hp);
+ IpAddress anIPA(*hp);
/* test stored values */
CPPUNIT_ASSERT( !anIPA.IsAnyAddr() );
}
void
-testIPAddress::testStringConstructor()
+testIpAddress::testStringConstructor()
{
struct in_addr outval;
struct in_addr expectval;
expectval.s_addr = htonl(0xC0A8640C);
- IPAddress anIPA = "192.168.100.12";
+ IpAddress anIPA = "192.168.100.12";
/* test stored values */
CPPUNIT_ASSERT( !anIPA.IsAnyAddr() );
expectv6.s6_addr32[2] = htonl(0x00000000);
expectv6.s6_addr32[3] = htonl(0x00000045);
- IPAddress bnIPA = "2000:800::45";
+ IpAddress bnIPA = "2000:800::45";
/* test stored values */
CPPUNIT_ASSERT( !bnIPA.IsAnyAddr() );
CPPUNIT_ASSERT( memcmp( &expectv6, &outval6, sizeof(struct in6_addr)) == 0 );
/* test IPv6 as an old netmask format. This is invalid but sometimes use. */
- IPAddress cnIPA = "ffff:ffff:fff0::";
+ IpAddress cnIPA = "ffff:ffff:fff0::";
expectv6.s6_addr32[0] = htonl(0xFFFFFFFF);
expectv6.s6_addr32[1] = htonl(0xFFF00000);
}
void
-testIPAddress::testSetEmpty()
+testIpAddress::testSetEmpty()
{
- IPAddress anIPA;
+ IpAddress anIPA;
struct in_addr inval;
inval.s_addr = htonl(0xC0A8640C);
}
void
-testIPAddress::testBooleans()
+testIpAddress::testBooleans()
{
- IPAddress lhsIPA;
- IPAddress rhsIPA;
+ IpAddress lhsIPA;
+ IpAddress rhsIPA;
struct in_addr valLow;
struct in_addr valHigh;
}
void
-testIPAddress::testNtoA()
+testIpAddress::testNtoA()
{
struct in_addr inval;
char buf[MAX_IPSTRLEN];
- IPAddress anIPA;
+ IpAddress anIPA;
anIPA.SetAnyAddr();
}
void
-testIPAddress::testToURL_fromInAddr()
+testIpAddress::testToURL_fromInAddr()
{
char buf[MAX_IPSTRLEN];
buf[0] = '\0';
inval.s_addr = htonl(0xC0A8640C);
- IPAddress anIPA(inval);
+ IpAddress anIPA(inval);
/* test values */
anIPA.ToURL(buf,MAX_IPSTRLEN);
ip6val.s6_addr32[2] = htonl(0xFFFFFFFF);
ip6val.s6_addr32[3] = htonl(0xFFFFFFFF);
- IPAddress bnIPA(ip6val);
+ IpAddress bnIPA(ip6val);
bnIPA.ToURL(buf,MAX_IPSTRLEN);
CPPUNIT_ASSERT( memcmp("[c0a8:640c:ffff:ffff:ffff:ffff:ffff:ffff]", buf, 41) == 0 );
}
void
-testIPAddress::testToURL_fromSockAddr()
+testIpAddress::testToURL_fromSockAddr()
{
struct sockaddr_in sock;
sock.sin_addr.s_addr = htonl(0xC0A8640C);
sock.sin_len = sizeof(struct sockaddr_in);
#endif
- IPAddress anIPA(sock);
+ IpAddress anIPA(sock);
char buf[MAX_IPSTRLEN];
/* test values */
ip6val.sin6_len = sizeof(struct sockaddr_in6);
#endif
- IPAddress bnIPA(ip6val);
+ IpAddress bnIPA(ip6val);
bnIPA.ToURL(buf,MAX_IPSTRLEN);
CPPUNIT_ASSERT( memcmp("[c0a8:640c:ffff:ffff:ffff:ffff:ffff:ffff]:80", buf, 44) == 0 );
}
void
-testIPAddress::testGetReverseString()
+testIpAddress::testGetReverseString()
{
char buf[MAX_IPSTRLEN];
struct in_addr ipv4val;
ipv4val.s_addr = htonl(0xC0A8640C);
- IPAddress v4IPA(ipv4val);
+ IpAddress v4IPA(ipv4val);
/* test IPv4 output */
v4IPA.GetReverseString(buf);
ip6val.s6_addr32[2] = htonl(0xFFFFFFFF);
ip6val.s6_addr32[3] = htonl(0xFFFFFFFF);
- IPAddress v6IPA(ip6val);
+ IpAddress v6IPA(ip6val);
/* test IPv6 output */
v6IPA.GetReverseString(buf);
}
void
-testIPAddress::testMasking()
+testIpAddress::testMasking()
{
char buf[MAX_IPSTRLEN];
- IPAddress anIPA;
- IPAddress maskIPA;
+ IpAddress anIPA;
+ IpAddress maskIPA;
/* Test Basic CIDR Routine */
anIPA.SetAnyAddr();
CPPUNIT_ASSERT( memcmp("ffff:ffff:ffff:ffff:ffff::", buf, 26) == 0 );
#endif
- /* Test Network Bitmask from IPAddress */
+ /* Test Network Bitmask from IpAddress */
anIPA.SetNoAddr();
maskIPA = "255.255.240.0";
CPPUNIT_ASSERT_EQUAL( 20 , maskIPA.GetCIDR() );
}
void
-testIPAddress::testAddrInfo()
+testIpAddress::testAddrInfo()
{
struct addrinfo *expect;
struct addrinfo *ipval = NULL;
hints.ai_flags = AI_NUMERICHOST;
- IPAddress anIP = "127.0.0.1";
+ IpAddress anIP = "127.0.0.1";
/* assert this just to check that getaddrinfo is working properly */
CPPUNIT_ASSERT( xgetaddrinfo("127.0.0.1", NULL, &hints, &expect ) == 0 );
}
void
-testIPAddress::testBugNullingDisplay()
+testIpAddress::testBugNullingDisplay()
{
// Weird Bug: address set to empty during string conversion somewhere.
// initial string gets created and returned OK.
expectval.s_addr = htonl(0xC0A8640C);
- IPAddress anIPA = "192.168.100.12";
+ IpAddress anIPA = "192.168.100.12";
/* test stored values */
* test the IP storage type
*/
-class testIPAddress : public CPPUNIT_NS::TestFixture
+class testIpAddress : public CPPUNIT_NS::TestFixture
{
- CPPUNIT_TEST_SUITE( testIPAddress );
+ CPPUNIT_TEST_SUITE( testIpAddress );
CPPUNIT_TEST( testDefaults );
CPPUNIT_TEST( testInAddrConstructor );
#if USE_IPV6
-
/*
- * $Id: ipc.cc,v 1.48 2008/02/13 00:01:47 rousskov Exp $
- *
* DEBUG: section 54 Interprocess Communication
* AUTHOR: Duane Wessels
*
#include "squid.h"
#include "comm.h"
#include "fde.h"
-#include "IPAddress.h"
+#include "ip/IpAddress.h"
static const char *hello_string = "hi there\n";
#define HELLO_BUF_SZ 32
}
pid_t
-ipcCreate(int type, const char *prog, const char *const args[], const char *name, IPAddress &local_addr, int *rfd, int *wfd, void **hIpc)
+ipcCreate(int type, const char *prog, const char *const args[], const char *name, IpAddress &local_addr, int *rfd, int *wfd, void **hIpc)
{
pid_t pid;
- IPAddress ChS;
- IPAddress PaS;
+ IpAddress ChS;
+ IpAddress PaS;
struct addrinfo *AI = NULL;
int crfd = -1;
int prfd = -1;
int type;
int crfd;
int cwfd;
- IPAddress local_addr;
+ IpAddress local_addr;
struct addrinfo PS;
const char *prog;
char **args;
}
pid_t
-ipcCreate(int type, const char *prog, const char *const args[], const char *name, IPAddress &local_addr, int *rfd, int *wfd, void **hIpc)
+ipcCreate(int type, const char *prog, const char *const args[], const char *name, IpAddress &local_addr, int *rfd, int *wfd, void **hIpc)
{
unsigned long thread;
DWORD ecode = 0;
pid_t pid;
- IPAddress tmp_addr;
+ IpAddress tmp_addr;
struct addrinfo *aiCS = NULL;
struct addrinfo *aiPS = NULL;
return ipcCloseAllFD(prfd, pwfd, crfd, cwfd);
}
- /* NP: tmp_addr was left with eiether empty or aiCS in IPAddress format */
+ /* NP: tmp_addr was left with eiether empty or aiCS in IpAddress format */
if (comm_connect_addr(pwfd, tmp_addr) == COMM_ERROR) {
CloseHandle((HANDLE) thread);
return ipcCloseAllFD(prfd, pwfd, -1, -1);
int prfd_ipc = -1, pwfd_ipc = -1, crfd_ipc = -1, cwfd_ipc = -1;
char *prog = NULL, *buf1 = NULL;
- IPAddress PS_ipc;
- IPAddress CS_ipc;
+ IpAddress PS_ipc;
+ IpAddress CS_ipc;
struct addrinfo *aiPS_ipc = NULL;
struct addrinfo *aiCS_ipc = NULL;
int cwfd = params->cwfd;
char **args = params->args;
- IPAddress PS = params->PS;
- IPAddress local_addr = params->local_addr;
+ IpAddress PS = params->PS;
+ IpAddress local_addr = params->local_addr;
buf1 = (char *)xcalloc(1, 8192);
strcpy(buf1, params->prog);
-
/*
- * $Id: ipcache.cc,v 1.269 2008/02/26 21:49:35 amosjeffries Exp $
- *
* DEBUG: section 14 IP Cache
* AUTHOR: Harvest Derived
*
#include "SquidTime.h"
#include "Store.h"
#include "wordlist.h"
-#include "IPAddress.h"
+#include "ip/IpAddress.h"
/**
\defgroup IPCacheAPI IP Cache API
if (ipcount > 0) {
int j, k;
- i->addrs.in_addrs = (IPAddress *)xcalloc(ipcount, sizeof(IPAddress));
+ i->addrs.in_addrs = (IpAddress *)xcalloc(ipcount, sizeof(IpAddress));
for (int l = 0; l < ipcount; l++)
i->addrs.in_addrs[l].SetEmpty(); // perform same init actions as constructor would.
i->addrs.bad_mask = (unsigned char *)xcalloc(ipcount, sizeof(unsigned char));
return 0;
}
- i->addrs.in_addrs = (IPAddress *)xcalloc(na, sizeof(IPAddress));
+ i->addrs.in_addrs = (IpAddress *)xcalloc(na, sizeof(IpAddress));
for (int l = 0; l < na; l++)
i->addrs.in_addrs[l].SetEmpty(); // perform same init actions as constructor would.
i->addrs.bad_mask = (unsigned char *)xcalloc(na, sizeof(unsigned char));
memset(&lru_list, '\0', sizeof(lru_list));
memset(&static_addrs, '\0', sizeof(ipcache_addrs));
- static_addrs.in_addrs = (IPAddress *)xcalloc(1, sizeof(IPAddress));
- static_addrs.in_addrs->SetEmpty(); // properly setup the IPAddress!
+ static_addrs.in_addrs = (IpAddress *)xcalloc(1, sizeof(IpAddress));
+ static_addrs.in_addrs->SetEmpty(); // properly setup the IpAddress!
static_addrs.bad_mask = (unsigned char *)xcalloc(1, sizeof(unsigned char));
ipcache_high = (long) (((float) Config.ipcache.size *
(float) Config.ipcache.high) / (float) 100);
#if DNS_CNAME
/**
- * Takes two IPAddress arrays and merges them into a single array
+ * Takes two IpAddress arrays and merges them into a single array
* which is allocated dynamically to fit the number of unique addresses
*
\param aaddrs One list to merge
\param outlen Size of list out
*/
void
-ipcacheMergeIPLists(const IPAddress *aaddrs, const int alen,
- const IPAddress *baddrs, const int blen,
- IPAddress **out, int &outlen )
+ipcacheMergeIPLists(const IpAddress *aaddrs, const int alen,
+ const IpAddress *baddrs, const int blen,
+ IpAddress **out, int &outlen )
{
int fc=0, t=0, c=0;
- IPAddress const *ip4ptrs[255];
+ IpAddress const *ip4ptrs[255];
#if USE_IPV6
- IPAddress const *ip6ptrs[255];
+ IpAddress const *ip6ptrs[255];
#endif
int num_ip4 = 0;
int num_ip6 = 0;
- memset(ip4ptrs, 0, sizeof(IPAddress*)*255);
+ memset(ip4ptrs, 0, sizeof(IpAddress*)*255);
#if USE_IPV6
- memset(ip6ptrs, 0, sizeof(IPAddress*)*255);
+ memset(ip6ptrs, 0, sizeof(IpAddress*)*255);
#endif
// for each unique address in list A - grab ptr
debugs(14, 5, "ipcacheMergeIPLists: Merge " << alen << "+" << blen << " into " << fc << " unique IPs.");
// copy the old IPs into the new list buffer.
- (*out) = (IPAddress*)xcalloc(fc, sizeof(IPAddress));
+ (*out) = (IpAddress*)xcalloc(fc, sizeof(IpAddress));
outlen=0;
assert(out != NULL);
#if DNS_CNAME
ipcache_entry *i = NULL;
char *pname = NULL;
- IPAddress *tmpbuf = NULL;
+ IpAddress *tmpbuf = NULL;
int fc = 0;
int ttl = 0;
generic_cbdata* gcb = (generic_cbdata*)cbdata;
ipcacheCheckNumeric(const char *name)
{
- IPAddress ip;
+ IpAddress ip;
/* check if it's already a IP address in text form. */
/* it may be IPv6-wrapped */
\param addr specific addres to be marked bad
*/
void
-ipcacheMarkBadAddr(const char *name, IPAddress &addr)
+ipcacheMarkBadAddr(const char *name, IpAddress &addr)
{
ipcache_entry *i;
ipcache_addrs *ia;
/// \ingroup IPCacheAPI
void
-ipcacheMarkGoodAddr(const char *name, IPAddress &addr)
+ipcacheMarkGoodAddr(const char *name, IpAddress &addr)
{
ipcache_entry *i;
ipcache_addrs *ia;
{
ipcache_entry *i;
- IPAddress ip;
+ IpAddress ip;
if (!(ip = ipaddr)) {
#if USE_IPV6
i->addrs.cur = 0;
i->addrs.badcount = 0;
- i->addrs.in_addrs = (IPAddress *)xcalloc(1, sizeof(IPAddress));
+ i->addrs.in_addrs = (IpAddress *)xcalloc(1, sizeof(IpAddress));
i->addrs.bad_mask = (unsigned char *)xcalloc(1, sizeof(unsigned char));
i->addrs.in_addrs[0] = ip;
i->addrs.bad_mask[0] = FALSE;
-
/*
- * $Id: neighbors.cc,v 1.353 2008/02/11 22:44:50 rousskov Exp $
- *
* DEBUG: section 15 Neighbor Routines
* AUTHOR: Harvest Derived
*
#include "PeerSelectState.h"
#include "SquidTime.h"
#include "Store.h"
-#include "IPAddress.h"
#include "icmp/net_db.h"
+#include "ip/IpAddress.h"
/* count mcast group peers every 15 minutes */
#define MCAST_COUNT_RATE 900
static void peerCountMcastPeersSchedule(peer * p, time_t when);
static IRCB peerCountHandleIcpReply;
-static void neighborIgnoreNonPeer(const IPAddress &, icp_opcode);
+static void neighborIgnoreNonPeer(const IpAddress &, icp_opcode);
static OBJH neighborDumpPeers;
static OBJH neighborDumpNonPeers;
static void dump_peers(StoreEntry * sentry, peer * peers);
peer *
-whichPeer(const IPAddress &from)
+whichPeer(const IpAddress &from)
{
int j;
void
neighbors_init(void)
{
- IPAddress nul;
+ IpAddress nul;
struct addrinfo *AI = NULL;
struct servent *sep = NULL;
const char *me = getMyHostname();
static peer *non_peers = NULL;
static void
-neighborIgnoreNonPeer(const IPAddress &from, icp_opcode opcode)
+neighborIgnoreNonPeer(const IpAddress &from, icp_opcode opcode)
{
peer *np;
*/
void
-neighborsUdpAck(const cache_key * key, icp_common_t * header, const IPAddress &from)
+neighborsUdpAck(const cache_key * key, icp_common_t * header, const IpAddress &from)
{
peer *p = NULL;
StoreEntry *entry;
if (squid_curtime - p->stats.last_connect_probe == 0)
return ret;/* don't probe to often */
- IPAddress temp(getOutgoingAddr(NULL,p));
+ IpAddress temp(getOutgoingAddr(NULL,p));
fd = comm_open(SOCK_STREAM, IPPROTO_TCP, temp, COMM_NONBLOCKING, p->host);
#if USE_HTCP
void
-neighborsHtcpReply(const cache_key * key, htcpReplyData * htcp, const IPAddress &from)
+neighborsHtcpReply(const cache_key * key, htcpReplyData * htcp, const IpAddress &from)
{
StoreEntry *e = Store::Root().get(key);
MemObject *mem = NULL;
/* ========== PconnPool PRIVATE FUNCTIONS ============================================ */
const char *
-PconnPool::key(const char *host, u_short port, const char *domain, IPAddress &client_address)
+PconnPool::key(const char *host, u_short port, const char *domain, IpAddress &client_address)
{
LOCAL_ARRAY(char, buf, SQUIDHOSTNAMELEN * 3 + 10);
char ntoabuf[MAX_IPSTRLEN];
}
void
-PconnPool::push(int fd, const char *host, u_short port, const char *domain, IPAddress &client_address)
+PconnPool::push(int fd, const char *host, u_short port, const char *domain, IpAddress &client_address)
{
IdleConnList *list;
* transactions create persistent connections but are not retriable.
*/
int
-PconnPool::pop(const char *host, u_short port, const char *domain, IPAddress &client_address, bool isRetriable)
+PconnPool::pop(const char *host, u_short port, const char *domain, IpAddress &client_address, bool isRetriable)
{
const char * aKey = key(host, port, domain, client_address);
};
-class IPAddress;
+class IpAddress;
class StoreEntry;
class IdleConnLimit;
PconnPool(const char *);
void moduleInit();
- void push(int fd, const char *host, u_short port, const char *domain, IPAddress &client_address);
- int pop(const char *host, u_short port, const char *domain, IPAddress &client_address, bool retriable);
+ void push(int fd, const char *host, u_short port, const char *domain, IpAddress &client_address);
+ int pop(const char *host, u_short port, const char *domain, IpAddress &client_address, bool retriable);
void count(int uses);
void dumpHist(StoreEntry *e);
void dumpHash(StoreEntry *e);
private:
- static const char *key(const char *host, u_short port, const char *domain, IPAddress &client_address);
+ static const char *key(const char *host, u_short port, const char *domain, IpAddress &client_address);
int hist[PCONN_HIST_SZ];
hash_table *table;
/*
- * $Id: protos.h,v 1.557 2008/02/26 21:49:35 amosjeffries Exp $
- *
- *
* SQUID Web Proxy Cache http://www.squid-cache.org/
* ----------------------------------------------------------
*
*/
#include "Packer.h"
/* for routines still in this file that take CacheManager parameters */
-#include "IPAddress.h"
+#include "ip/IpAddress.h"
/* for parameters that still need these */
#include "enums.h"
/* some parameters stil need this */
SQUIDCEXTERN void requirePathnameExists(const char *name, const char *path);
SQUIDCEXTERN void parse_time_t(time_t * var);
-SQUIDCEXTERN void parse_IPAddress_list_token(IPAddress_list **, char *);
+SQUIDCEXTERN void parse_IpAddress_list_token(IpAddress_list **, char *);
/* client_side.c - FD related client side routines */
SQUIDCEXTERN void clientdbInit(void);
-SQUIDCEXTERN void clientdbUpdate(const IPAddress &, log_type, protocol_t, size_t);
+SQUIDCEXTERN void clientdbUpdate(const IpAddress &, log_type, protocol_t, size_t);
-SQUIDCEXTERN int clientdbCutoffDenied(const IPAddress &);
+SQUIDCEXTERN int clientdbCutoffDenied(const IpAddress &);
SQUIDCEXTERN void clientdbDump(StoreEntry *);
SQUIDCEXTERN void clientdbFreeMemory(void);
-SQUIDCEXTERN int clientdbEstablished(const IPAddress &, int);
+SQUIDCEXTERN int clientdbEstablished(const IpAddress &, int);
SQUIDCEXTERN void clientOpenListenSockets(void);
SQUIDCEXTERN void clientHttpConnectionsClose(void);
SQUIDCEXTERN void httpRequestFree(void *);
SQUIDCEXTERN void idnsShutdown(void);
SQUIDCEXTERN void idnsALookup(const char *, IDNSCB *, void *);
-SQUIDCEXTERN void idnsPTRLookup(const IPAddress &, IDNSCB *, void *);
+SQUIDCEXTERN void idnsPTRLookup(const IpAddress &, IDNSCB *, void *);
SQUIDCEXTERN void fd_close(int fd);
SQUIDCEXTERN void fd_open(int fd, unsigned int type, const char *);
SQUIDCEXTERN void filemapFreeMemory(fileMap *);
-SQUIDCEXTERN void fqdncache_nbgethostbyaddr(IPAddress &, FQDNH *, void *);
+SQUIDCEXTERN void fqdncache_nbgethostbyaddr(IpAddress &, FQDNH *, void *);
-SQUIDCEXTERN const char *fqdncache_gethostbyaddr(IPAddress &, int flags);
+SQUIDCEXTERN const char *fqdncache_gethostbyaddr(IpAddress &, int flags);
SQUIDCEXTERN void fqdncache_init(void);
SQUIDCEXTERN void fqdnStats(StoreEntry *);
SQUIDCEXTERN void fqdncacheReleaseInvalid(const char *);
-SQUIDCEXTERN const char *fqdnFromAddr(IPAddress &);
+SQUIDCEXTERN const char *fqdnFromAddr(IpAddress &);
SQUIDCEXTERN int fqdncacheQueueDrain(void);
SQUIDCEXTERN void fqdncacheFreeMemory(void);
SQUIDCEXTERN void fqdncache_restart(void);
SQUIDCEXTERN void snmpConnectionClose(void);
SQUIDCEXTERN void snmpDebugOid(int lvl, oid * Name, snint Len);
-SQUIDCEXTERN void addr2oid(IPAddress &addr, oid *Dest);
-SQUIDCEXTERN void oid2addr(oid *Dest, IPAddress &addr, u_int code);
+SQUIDCEXTERN void addr2oid(IpAddress &addr, oid *Dest);
+SQUIDCEXTERN void oid2addr(oid *Dest, IpAddress &addr, u_int code);
-SQUIDCEXTERN IPAddress *client_entry(IPAddress *current);
+SQUIDCEXTERN IpAddress *client_entry(IpAddress *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, IPAddress &);
+SQUIDCEXTERN void ipcacheMarkBadAddr(const char *name, IpAddress &);
-SQUIDCEXTERN void ipcacheMarkGoodAddr(const char *name, IPAddress &);
+SQUIDCEXTERN void ipcacheMarkGoodAddr(const char *name, IpAddress &);
SQUIDCEXTERN void ipcacheFreeMemory(void);
SQUIDCEXTERN ipcache_addrs *ipcacheCheckNumeric(const char *name);
SQUIDCEXTERN void ipcache_restart(void);
int *timeout);
SQUIDCEXTERN void neighborAddAcl(const char *, const char *);
-SQUIDCEXTERN void neighborsUdpAck(const cache_key *, icp_common_t *, const IPAddress &);
+SQUIDCEXTERN void neighborsUdpAck(const cache_key *, icp_common_t *, const IpAddress &);
SQUIDCEXTERN void neighborAdd(const char *, const char *, int, int, int, int, int);
SQUIDCEXTERN void neighbors_init(void);
#if USE_HTCP
SQUIDCEXTERN void dump_peer_options(StoreEntry *, peer *);
SQUIDCEXTERN int peerHTTPOkay(const peer *, HttpRequest *);
-SQUIDCEXTERN peer *whichPeer(const IPAddress &from);
+SQUIDCEXTERN peer *whichPeer(const IpAddress &from);
SQUIDCEXTERN void peerSelect(HttpRequest *, StoreEntry *, PSC *, void *data);
SQUIDCEXTERN void peerSelectInit(void);
SQUIDCEXTERN void peerDigestNotePeerGone(PeerDigest * pd);
SQUIDCEXTERN void peerDigestStatsReport(const PeerDigest * pd, StoreEntry * e);
-extern IPAddress getOutgoingAddr(HttpRequest * request, struct peer *dst_peer);
+extern IpAddress getOutgoingAddr(HttpRequest * request, struct peer *dst_peer);
unsigned long getOutgoingTOS(HttpRequest * request);
SQUIDCEXTERN void urnStart(HttpRequest *, StoreEntry *);
const char *prog,
const char *const args[],
const char *name,
- IPAddress &local_addr,
+ IpAddress &local_addr,
int *rfd,
int *wfd,
void **hIpc);
void *data;
char *orig_url;
- IPAddress client_addr;
+ IpAddress client_addr;
const char *client_ident;
const char *method_s;
RH *handler;
LOCAL_ARRAY(char, tbuf, 256);
LOCAL_ARRAY(char, sndbuf, BUFSIZ);
- IPAddress S;
+ IpAddress S;
char *host = Config.Announce.host;
char *file = NULL;
u_short port = Config.Announce.port;
{
variable_list *Answer = NULL;
- IPAddress laddr;
+ IpAddress laddr;
char *cp = NULL;
peer *p = NULL;
int cnt = 0;
/*
- * $Id: snmp_core.cc,v 1.82 2008/01/22 21:07:19 rousskov Exp $
- *
* DEBUG: section 49 SNMP support
* AUTHOR: Glenn Chisholm
*
#include "comm.h"
#include "cache_snmp.h"
#include "ACLChecklist.h"
-#include "IPAddress.h"
+#include "ip/IpAddress.h"
#define SNMP_REQUEST_SIZE 4096
#define MAX_PROTOSTAT 5
-IPAddress theOutSNMPAddr;
+IpAddress theOutSNMPAddr;
typedef struct _mib_tree_entry mib_tree_entry;
typedef oid *(instance_Fn) (oid * name, snint * len, mib_tree_entry * current, oid_ParseFn ** Fn);
snmpHandleUdp(int sock, void *not_used)
{
LOCAL_ARRAY(char, buf, SNMP_REQUEST_SIZE);
- IPAddress from;
+ IpAddress from;
snmp_request_t *snmp_rq;
int len;
client_Inst(oid * name, snint * len, mib_tree_entry * current, oid_ParseFn ** Fn)
{
oid *instance = NULL;
- IPAddress laddr;
- IPAddress *aux;
+ IpAddress laddr;
+ IpAddress *aux;
int size = 0;
int newshift = 0;
oid == 32.1.50.239.162.33.251.20.50.0.0.0.0.0.0.0.0.0.1
*/
void
-addr2oid(IPAddress &addr, oid * Dest)
+addr2oid(IpAddress &addr, oid * Dest)
{
u_int i ;
u_char *cp = NULL;
IPv6 adress : 20:01:32:ef:a2:21:fb:32:00:00:00:00:00:00:00:00:OO:01
*/
void
-oid2addr(oid * id, IPAddress &addr, u_int size)
+oid2addr(oid * id, IpAddress &addr, u_int size)
{
struct in_addr iaddr;
u_int i;
-
/*
- * $Id: squid.h,v 1.272 2008/02/26 21:49:35 amosjeffries Exp $
- *
* AUTHOR: Duane Wessels
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
#include "profiling.h"
#include "MemPool.h"
-#include "IPAddress.h"
+#include "ip/IpAddress.h"
#if !HAVE_TEMPNAM
#include "tempnam.h"
/*
- * $Id: structs.h,v 1.575 2008/02/11 22:28:47 rousskov Exp $
- *
- *
* SQUID Web Proxy Cache http://www.squid-cache.org/
* ----------------------------------------------------------
*
long reqid;
int outlen;
- IPAddress from;
+ IpAddress from;
struct snmp_pdu *PDU;
ACLChecklist *acl_checklist;
acl_address *next;
ACLList *aclList;
- IPAddress addr;
+ IpAddress addr;
};
struct acl_tos {
struct {
- IPAddress router;
+ IpAddress router;
- IPAddress address;
+ IpAddress address;
int version;
} Wccp;
#endif
#if USE_WCCPv2
struct {
- IPAddress_list *router;
+ IpAddress_list *router;
- IPAddress address;
+ IpAddress address;
int forwarding_method;
int return_method;
int assignment_method;
struct {
- IPAddress udp_incoming;
+ IpAddress udp_incoming;
- IPAddress udp_outgoing;
+ IpAddress udp_outgoing;
#if SQUID_SNMP
- IPAddress snmp_incoming;
+ IpAddress snmp_incoming;
- IPAddress snmp_outgoing;
+ IpAddress snmp_outgoing;
#endif
/* FIXME INET6 : this should really be a CIDR value */
- IPAddress client_netmask;
+ IpAddress client_netmask;
} Addrs;
size_t tcpRcvBufsz;
size_t udpMaxHitObjsz;
struct {
- IPAddress addr;
+ IpAddress addr;
int ttl;
unsigned short port;
char *encode_key;
};
struct _ipcache_addrs {
- IPAddress *in_addrs;
+ IpAddress *in_addrs;
unsigned char *bad_mask;
unsigned char count;
unsigned char cur;
char *host;
peer_t type;
- IPAddress in_addr;
+ IpAddress in_addr;
struct {
int pings_sent;
int tcp_up; /* 0 if a connect() fails */
- IPAddress addresses[10];
+ IpAddress addresses[10];
int n_addresses;
int rr_count;
peer *next;
struct _ClientInfo {
hash_link hash; /* must be first */
- IPAddress addr;
+ IpAddress addr;
struct {
int result_hist[LOG_TYPE_MAX];
/* bah, cheating on stub count */
pid_t
-ipcCreate(int type, const char *prog, const char *const args[], const char *name, IPAddress &local_addr, int *rfd, int *wfd, void **hIpc)
+ipcCreate(int type, const char *prog, const char *const args[], const char *name, IpAddress &local_addr, int *rfd, int *wfd, void **hIpc)
{
fatal ("Not implemented");
return -1;
LOCAL_ARRAY(char, host, SQUIDHOSTNAMELEN + 1);
static int present = 0;
struct addrinfo *AI = NULL;
- IPAddress sa;
+ IpAddress sa;
if (Config.visibleHostname != NULL)
return Config.visibleHostname;
statCounter.server.all.requests++;
statCounter.server.other.requests++;
/* Create socket. */
- IPAddress temp = getOutgoingAddr(request,NULL);
+ IpAddress temp = getOutgoingAddr(request,NULL);
sock = comm_openex(SOCK_STREAM,
IPPROTO_TCP,
temp,
unlinkdInit(void)
{
const char *args[2];
- IPAddress localhost;
+ IpAddress localhost;
args[0] = "(unlinkd)";
args[1] = NULL;
};
struct wccp_cache_entry_t {
- IPAddress ip_addr;
+ IpAddress ip_addr;
int revision;
char hash[WCCP_HASH_SIZE];
int reserved;
static int last_assign_buckets_change;
static unsigned int number_caches;
-static IPAddress local_ip;
+static IpAddress local_ip;
static PF wccpHandleUdp;
static int wccpLowestIP(void);
wccpHandleUdp(int sock, void *not_used)
{
- IPAddress from;
+ IpAddress from;
int len;
debugs(80, 6, "wccpHandleUdp: Called.");
-
/*
- * $Id: wccp2.cc,v 1.23 2008/02/09 03:48:05 swilton Exp $
- *
* DEBUG: section 80 WCCP Support
* AUTHOR: Steven Wilton
*
#include "Parsing.h"
#include "Store.h"
#include "SwapDir.h"
-#include "IPAddress.h"
+#include "ip/IpAddress.h"
#if USE_WCCPv2
#if HAVE_NETDB_H
void
wccp2Init(void)
{
- IPAddress_list *s;
+ IpAddress_list *s;
char *ptr;
uint32_t service_flags;
commSetSelect(sock, COMM_SELECT_READ, wccp2HandleUdp, NULL, 0);
/* FIXME INET6 : drop conversion boundary */
- IPAddress from_tmp;
+ IpAddress from_tmp;
len = comm_udp_recvfrom(sock,
&wccp2_i_see_you,
struct wccp2_mask_identity_info_t *wccp2_mask_identity_info_ptr;
- IPAddress router;
+ IpAddress router;
debugs(80, 6, "wccp2HereIam: Called");
if (wccp2_numrouters > 1) {
/* FIXME INET6 : drop temp conversion */
- IPAddress tmp_rtr(router);
+ IpAddress tmp_rtr(router);
comm_udp_sendto(theWccp2Connection,
tmp_rtr,
&wccp_packet,
int new_socket;
fde *F = NULL;
- IPAddress localhost;
- IPAddress handle0;
- IPAddress handle1;
+ IpAddress localhost;
+ IpAddress handle0;
+ IpAddress handle1;
struct addrinfo *AI = NULL;
localhost.SetLocalhost();
#
# Makefile for the Squid Object Cache server
#
-# $Id: Makefile.am,v 1.2 2006/05/11 12:25:39 hno Exp $
-#
# Uncomment and customize the following to suit your needs:
#
AUTOMAKE_OPTIONS = subdir-objects
-INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include -I$(top_srcdir)/include -I$(top_srcdir)/lib/libTrie/include
+INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include -I$(top_srcdir)/include -I$(top_srcdir)/lib/libTrie/include -I$(top_srcdir)/src
INCLUDES += @SQUID_CPPUNIT_INC@
TESTS=$(check_PROGRAMS)
cachemgr__CGIEXT__SOURCES = cachemgr.cc
cachemgr__CGIEXT__CXXFLAGS = -DDEFAULT_CACHEMGR_CONFIG=\"$(DEFAULT_CACHEMGR_CONFIG)\" $(AM_CXXFLAGS)
-LDADD = -L../lib -lmiscutil $(XTRA_LIBS)
+LDADD = ../src/ip/libip.la -L../lib -lmiscutil $(XTRA_LIBS)
EXTRA_DIST = \
cachemgr.conf
/*
- * $Id: cachemgr.cc,v 1.6 2007/12/14 23:11:53 amosjeffries Exp $
- *
* DEBUG: section 0 CGI Cache Manager
* AUTHOR: Duane Wessels
*
#include "assert.h"
#include "util.h"
-#include "IPAddress.h"
+#include "ip/IpAddress.h"
#include "getfullhostname.h"
#ifndef DEFAULT_CACHEMGR_CONFIG
char ipbuf[MAX_IPSTRLEN];
struct addrinfo *AI = NULL;
- IPAddress S;
+ IpAddress S;
int s;
int l;
-
/*
- * $Id: squidclient.cc,v 1.11 2008/02/26 21:49:46 amosjeffries Exp $
- *
* DEBUG: section 0 WWW Client
* AUTHOR: Harvest Derived
*
#endif
#include "util.h"
-#include "IPAddress.h"
+#include "ip/IpAddress.h"
#ifndef BUFSIZ
#define BUFSIZ 8192
typedef void SIGHDLR(int sig);
/* Local functions */
-static int client_comm_bind(int, const IPAddress &);
+static int client_comm_bind(int, const IpAddress &);
-static int client_comm_connect(int, const IPAddress &, struct timeval *);
+static int client_comm_connect(int, const IpAddress &, struct timeval *);
static void usage(const char *progname);
static int Now(struct timeval *);
int opt_noaccept = 0;
int opt_verbose = 0;
const char *hostname, *localhost;
- IPAddress iaddr;
+ IpAddress iaddr;
char url[BUFSIZ], msg[MESSAGELEN], buf[BUFSIZ];
char extra_hdrs[HEADERLEN];
const char *method = "GET";
}
static int
-client_comm_bind(int sock, const IPAddress &addr) {
+client_comm_bind(int sock, const IpAddress &addr) {
int res;
}
static int
-client_comm_connect(int sock, const IPAddress &addr, struct timeval *tvp) {
+client_comm_connect(int sock, const IpAddress &addr, struct timeval *tvp) {
int res;
static struct addrinfo *AI = NULL;