Use uint16_t for precise binary size or unsigned short instead.
#define SIGUSR1 30 /* user defined signal 1 */
#define SIGUSR2 31 /* user defined signal 2 */
-typedef unsigned short int ushort;
#if !_SQUID_CYGWIN_
typedef int uid_t;
typedef int gid_t;
typedef struct pw_auth_hdr {
u_char code;
u_char id;
- u_short length;
+ uint16_t length;
u_char vector[AUTH_VECTOR_LEN];
u_char data[2];
} AUTH_HDR;
* Receive and verify the result.
*/
static int
-result_recv(u_int32_t host, u_short udp_port, char *buffer, int length)
+result_recv(uint32_t host, unsigned short udp_port, char *buffer, int length)
{
AUTH_HDR *auth;
int totallen;
authenticate(int socket_fd, const char *username, const char *passwd)
{
AUTH_HDR *auth;
- u_short total_length;
+ unsigned short total_length;
u_char *ptr;
int length;
char passbuf[MAXPASS];
struct sockaddr_in salocal;
struct sockaddr_in saremote;
struct servent *svp;
- u_short svc_port;
+ unsigned short svc_port;
char username[MAXPWNAM];
char passwd[MAXPASS];
char *ptr;
*/
svp = getservbyname(svc_name, "udp");
if (svp != NULL)
- svc_port = ntohs((u_short) svp->s_port);
+ svc_port = ntohs((unsigned short) svp->s_port);
else
svc_port = atoi(svc_name);
if (svc_port == 0)
ntlmGetString(ntlmhdr * hdr, strhdr * str, int flags)
{
static char buf[512];
- u_short *s, c;
+ unsigned short *s, c;
char *d, *sc;
int l, o;
}
if ((flags & NEGOTIATE_ASCII) == 0) {
/* UNICODE string */
- s = (u_short *) ((char *) hdr + o);
+ s = (unsigned short *) ((char *) hdr + o);
d = buf;
for (l >>= 1; l; s++, l--) {
/// \ingroup MemPoolsAPI
#define MEM_MIN_FREE 32
/// \ingroup MemPoolsAPI
-#define MEM_MAX_FREE 65535 /* ushort is max number of items per chunk */
+#define MEM_MAX_FREE 65535 /* unsigned short is max number of items per chunk */
class MemImplementingAllocator;
class MemPoolStats;
/// \ingroup MemPoolsAPI
#define MEM_MIN_FREE 32
/// \ingroup MemPoolsAPI
-#define MEM_MAX_FREE 65535 /* ushort is max number of items per chunk */
+#define MEM_MAX_FREE 65535 /* unsigned short is max number of items per chunk */
class MemChunk;
/* Convert error return from getaddrinfo() to string */
SQUIDCEXTERN const char *xgai_strerror (int code);
-<<<<<<< TREE
-=======
-#if !defined(gai_strerror)
- >>>>>>> MERGE-SOURCE
- <<<<<<< TREE
- =======
-#endif
- >>>>>>> MERGE-SOURCE
#endif /* HAVE_GETADDRINFO */
int retries; /* Number of retries before timeout. */
int timeout; /* Number of uS until first timeout, then exponential backoff */
char *peername; /* Domain name or dotted IP address of default peer */
- u_short remote_port; /* UDP port number of peer. */
- u_short local_port; /* My UDP port number, 0 for default, picked randomly */
+ unsigned short remote_port; /* UDP port number of peer. */
+ unsigned short local_port; /* My UDP port number, 0 for default, picked randomly */
};
#define RECEIVED_MESSAGE 1
const struct afd *afd;
struct servent *sp;
struct hostent *hp;
- u_short port;
+ unsigned short port;
int family, i;
const char *addr;
u_int32_t v4a;
public:
void destruct();
- static void ParseUShort(u_short *var);
+ static void ParseUShort(unsigned short *var);
static void ParseBool(bool *var);
static void ParseString(char **var);
static void ParseString(String *var);
void
DelayConfig::parsePoolCount()
{
- u_short pools_;
+ unsigned short pools_;
ConfigParser::ParseUShort(&pools_);
DelayPools::pools(pools_);
}
void
DelayConfig::parsePoolClass()
{
- ushort pool;
+ unsigned short pool;
ConfigParser::ParseUShort(&pool);
return;
}
- ushort delay_class_;
+ unsigned short delay_class_;
ConfigParser::ParseUShort(&delay_class_);
if (delay_class_ < 1 || delay_class_ > 5) {
void
DelayConfig::parsePoolRates()
{
- ushort pool;
+ unsigned short pool;
ConfigParser::ParseUShort(&pool);
if (pool < 1 || pool > DelayPools::pools()) {
void
DelayConfig::parsePoolAccess(ConfigParser &parser)
{
- ushort pool;
+ unsigned short pool;
ConfigParser::ParseUShort(&pool);
static void Init();
static void Update(void *);
static unsigned short pools();
- static void pools (u_short pools);
+ static void pools(unsigned short pools);
static void FreePools();
static unsigned char *DelayClasses();
static void registerForUpdates(Updateable *);
AuthUserRequest *auth_user_request;
- u_short port;
+ unsigned short port;
String urlpath;
return i;
}
-u_short
+unsigned short
GetShort(void)
{
char *token = strtok(NULL, w_space);
*/
extern int GetInteger(void);
-extern u_short GetShort(void);
+extern unsigned short GetShort(void);
// on success, returns true and sets *p (if any) to the end of the integer
extern bool StringToInt(const char *str, int &result, const char **p, int base);
time_t expires;
time_t lastmod;
uint64_t swap_file_sz;
- u_short refcount;
- u_short flags;
+ uint16_t refcount;
+ uint16_t flags;
/* END OF ON-DISK STORE_META_STD */
sfileno swap_filen:25;
sdirno swap_dirn:7;
- u_short lock_count; /* Assume < 65536! */
+ unsigned short lock_count; /* Assume < 65536! */
mem_status_t mem_status:3;
time_t lastref;
time_t expires;
time_t lastmod;
- size_t swap_file_sz;
- u_short refcount;
- u_short flags;
+ uint64_t swap_file_sz;
+ uint16_t refcount;
+ uint16_t flags;
\endcode
*/
STORE_META_STD,
* Since its a 16-bit quantity, it is susceptible to overflow
* if a single object is accessed 65,536 times before being replaced.
*/
- u_short refcount;
+ uint16_t refcount;
/**
* A copy of the StoreEntry flags field. Used as a sanity
* check when rebuilding the cache at startup. Objects that
* have the KEY_PRIVATE flag set are not added back to the cache.
*/
- u_short flags;
+ uint16_t flags;
/**
* The 128-bit MD5 hash for this object.
static void parse_refreshpattern(refresh_t **);
static int parseTimeUnits(const char *unit);
static void parseTimeLine(time_t * tptr, const char *units);
-static void parse_ushort(u_short * var);
+static void parse_ushort(unsigned short * var);
static void parse_string(char **);
static void default_all(void);
static void defaults_if_none(void);
\param proto 'tcp' or 'udp' for protocol
\returns Port the named service is supposed to be listening on.
*/
-static u_short
+static unsigned short
GetService(const char *proto)
{
struct servent *port = NULL;
if ( !isUnsignedNumeric(token, strlen(token)) )
port = getservbyname(token, proto);
if (port != NULL) {
- return ntohs((u_short)port->s_port);
+ return ntohs((unsigned short)port->s_port);
}
/** Or a numeric translation of the config text. */
return xatos(token);
\returns Port the named TCP service is supposed to be listening on.
\copydoc GetService(const char *proto)
*/
-inline u_short
+inline unsigned short
GetTcpService(void)
{
return GetService("tcp");
\returns Port the named UDP service is supposed to be listening on.
\copydoc GetService(const char *proto)
*/
-inline u_short
+inline unsigned short
GetUdpService(void)
{
return GetService("udp");
#define free_kb_int64_t free_b_int64_t
static void
-dump_ushort(StoreEntry * entry, const char *name, u_short var)
+dump_ushort(StoreEntry * entry, const char *name, unsigned short var)
{
storeAppendPrintf(entry, "%s %d\n", name, var);
}
static void
-free_ushort(u_short * u)
+free_ushort(unsigned short * u)
{
*u = 0;
}
static void
-parse_ushort(u_short * var)
+parse_ushort(unsigned short * var)
{
ConfigParser::ParseUShort(var);
}
void
-ConfigParser::ParseUShort(u_short *var)
+ConfigParser::ParseUShort(unsigned short *var)
{
*var = GetShort();
}
// defaults given by client
char *host;
- u_short default_port;
+ unsigned short default_port;
IpAddress default_addr;
// NP: CANNOT store the default addr:port together as it gets set/reset differently.
*/
/* Return the local port associated with fd. */
-u_short
+unsigned short
comm_local_port(int fd)
{
IpAddress temp;
if ((flags & COMM_REUSEADDR))
commSetReuseAddr(new_socket);
- if (addr.GetPort() > (u_short) 0) {
+ if (addr.GetPort() > (unsigned short) 0) {
#ifdef _SQUID_MSWIN_
if (sock_type != SOCK_DGRAM)
#endif
void
-commConnectStart(int fd, const char *host, u_short port, AsyncCall::Pointer &cb)
+commConnectStart(int fd, const char *host, unsigned short port, AsyncCall::Pointer &cb)
{
debugs(cb->debugSection, cb->debugLevel, "commConnectStart: FD " << fd <<
", cb " << cb << ", " << host << ":" << port); // TODO: just print *cb
// a generic call name and debug level when creating an AsyncCall. This will
// also cut the number of callback registration routines in half.
void
-commConnectStart(int fd, const char *host, u_short port, CNCB * callback, void *data)
+commConnectStart(int fd, const char *host, unsigned short port, CNCB * callback, void *data)
{
debugs(5, 5, "commConnectStart: FD " << fd << ", data " << data << ", " << host << ":" << port);
AsyncCall::Pointer call = commCbCall(5,3,
#if LINGERING_CLOSE
SQUIDCEXTERN void comm_lingering_close(int fd);
#endif
-SQUIDCEXTERN void commConnectStart(int fd, const char *, u_short, CNCB *, void *);
-void commConnectStart(int fd, const char *, u_short, AsyncCall::Pointer &cb);
+SQUIDCEXTERN void commConnectStart(int fd, const char *, unsigned short, CNCB *, void *);
+void commConnectStart(int fd, const char *, unsigned short, AsyncCall::Pointer &cb);
SQUIDCEXTERN int comm_connect_addr(int sock, const IpAddress &addr);
SQUIDCEXTERN void comm_init(void);
SQUIDCEXTERN int comm_open_listener(int sock_type, int proto, IpAddress &addr, int flags, const char *note);
SQUIDCEXTERN int comm_openex(int, int, IpAddress &, int, unsigned char TOS, const char *);
-SQUIDCEXTERN u_short comm_local_port(int fd);
+SQUIDCEXTERN unsigned 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);
#define SwapMetaType(x) (char)x[0]
#define SwapMetaSize(x) &x[sizeof(char)]
#define SwapMetaData(x) &x[STORE_META_TLD_START]
-#define STORE_HDR_METASIZE (4*sizeof(time_t)+2*sizeof(u_short)+sizeof(uint64_t))
-#define STORE_HDR_METASIZE_OLD (4*sizeof(time_t)+2*sizeof(u_short)+sizeof(size_t))
+#define STORE_HDR_METASIZE (4*sizeof(time_t)+2*sizeof(uint16_t)+sizeof(uint64_t))
+#define STORE_HDR_METASIZE_OLD (4*sizeof(time_t)+2*sizeof(uint16_t)+sizeof(size_t))
#define COUNT_INTERVAL 60
/*
}
void
-DelayPools::pools (u_short newPools)
+DelayPools::pools(unsigned short newPools)
{
if (pools()) {
debugs(3, 0, "parse_delay_pool_count: multiple delay_pools lines, aborting all previous delay_pools config");
HttpRequest *request;
char *url;
int xerrno;
- u_short port;
+ unsigned short port;
String dnsError; ///< DNS lookup error message
time_t ttl;
void noteUse(PconnPool *);
unsigned int type;
- u_short remote_port;
+ unsigned short remote_port;
IpAddress local_addr;
unsigned char tos;
time_t expires;
time_t lastmod;
uint32_t swap_file_sz;
- u_short refcount;
- u_short flags;
+ uint16_t refcount;
+ uint16_t flags;
unsigned char key[SQUID_MD5_DIGEST_LENGTH];
};
UFSSwapLogParser_v1_32bs(FILE *fp):UFSSwapLogParser(fp) {
int32_t expires;
int32_t lastmod;
uint32_t swap_file_sz;
- u_short refcount;
- u_short flags;
+ uint16_t refcount;
+ uint16_t flags;
unsigned char key[SQUID_MD5_DIGEST_LENGTH];
};
UFSSwapLogParser_v1_32bst(FILE *fp):UFSSwapLogParser(fp) {
time_t expires;
time_t lastmod;
uint64_t swap_file_sz;
- u_short refcount;
- u_short flags;
+ uint16_t refcount;
+ uint16_t flags;
unsigned char key[SQUID_MD5_DIGEST_LENGTH];
};
UFSSwapLogParser_v1_64bfn(FILE *fp):UFSSwapLogParser(fp) {
time_t expires;
time_t lastmod;
size_t swap_file_sz;
- u_short refcount;
- u_short flags;
+ uint16_t refcount;
+ uint16_t flags;
} *tmp;
tmp = (struct old_metahdr *)x.value;
assert(x.length == STORE_HDR_METASIZE_OLD);
struct DataChannel: public FtpChannel {
MemBuf *readBuf;
char *host;
- u_short port;
+ unsigned short port;
bool read_pending;
} data;
{
int code = ftpState->ctrl.replycode;
char h1, h2, h3, h4;
- u_short port;
+ unsigned short port;
IpAddress ipa_remote;
int fd = ftpState->data.fd;
char *buf;
int h1, h2, h3, h4;
int p1, p2;
int n;
- u_short port;
+ unsigned short port;
IpAddress ipa_remote;
int fd = ftpState->data.fd;
char *buf;
static ssize_t
htcpBuildClrOpData(char *buf, size_t buflen, htcpStuff * stuff)
{
- u_short reason;
+ unsigned short reason;
switch (stuff->rr) {
case RR_REQUEST:
debugs(31, 3, "htcpBuildClrOpData: RR_REQUEST");
- reason = htons((u_short)stuff->reason);
+ reason = htons((unsigned short)stuff->reason);
xmemcpy(buf, &reason, 2);
return htcpBuildSpecifier(buf + 2, buflen - 2, stuff) + 2;
case RR_RESPONSE:
icmp->icmp_code = 0;
icmp->icmp_cksum = 0;
icmp->icmp_id = icmp_ident;
- icmp->icmp_seq = (u_short) icmp_pkts_sent++;
+ icmp->icmp_seq = (unsigned short) icmp_pkts_sent++;
// Construct ICMP packet data content
echo = (icmpEchoData *) (icmp + 1);
icmp_pktsize += len;
}
- icmp->icmp_cksum = CheckSum((u_short *) icmp, icmp_pktsize);
+ icmp->icmp_cksum = CheckSum((unsigned short *) icmp, icmp_pktsize);
to.GetAddrInfo(S);
((sockaddr_in*)S->ai_addr)->sin_port = 0;
icmp->icmp6_code = 0;
icmp->icmp6_cksum = 0;
icmp->icmp6_id = icmp_ident;
- icmp->icmp6_seq = (u_short) icmp_pkts_sent++;
+ icmp->icmp6_seq = (unsigned short) icmp_pkts_sent++;
icmp6_pktsize = sizeof(struct icmp6_hdr);
icmp6_pktsize += len;
}
- icmp->icmp6_cksum = CheckSum((u_short *) icmp, icmp6_pktsize);
+ icmp->icmp6_cksum = CheckSum((unsigned short *) icmp, icmp6_pktsize);
to.GetAddrInfo(S);
((sockaddr_in6*)S->ai_addr)->sin6_port = 0;
* makes internal url with a given host and port (remote internal url)
*/
char *
-internalRemoteUri(const char *host, u_short port, const char *dir, const char *name)
+internalRemoteUri(const char *host, unsigned short port, const char *dir, const char *name)
{
static char lc_host[SQUIDHOSTNAMELEN];
assert(host && name);
return ( matchIPAddr(rhs) < 0);
}
-u_short IpAddress::GetPort() const
+unsigned short
+IpAddress::GetPort() const
{
return ntohs( m_SocketAddr.sin6_port );
}
-u_short IpAddress::SetPort(u_short prt)
+unsigned short
+IpAddress::SetPort(unsigned short prt)
{
m_SocketAddr.sin6_port = htons(prt);
\retval 0 Port is unset or an error occured.
\retval n Port associated with this address in host native -endian.
*/
- u_short GetPort() const;
+ unsigned short GetPort() const;
/** Set the Port value for an address.
* Replaces any previously existing Port value.
\retval 0 Port is unset or an error occured.
\retval n Port associated with this address in host native -endian.
*/
- u_short SetPort(u_short port);
+ unsigned short SetPort(unsigned short port);
/// Set object to contain the specific IP case ANY_ADDR (format-neutral).
/// see IsAnyAddr() for more detail.
CPPUNIT_ASSERT( !anIPA.IsNoAddr() );
CPPUNIT_ASSERT( anIPA.IsIPv4() );
CPPUNIT_ASSERT( !anIPA.IsSockAddr() );
- CPPUNIT_ASSERT_EQUAL( (u_short) 0 , anIPA.GetPort() );
+ CPPUNIT_ASSERT_EQUAL( (unsigned short) 0 , anIPA.GetPort() );
CPPUNIT_ASSERT( anIPA.IsIPv6() );
}
CPPUNIT_ASSERT( anIPA.IsIPv4() );
CPPUNIT_ASSERT( !anIPA.IsIPv6() );
CPPUNIT_ASSERT( !anIPA.IsSockAddr() );
- CPPUNIT_ASSERT_EQUAL( (u_short) 0 , anIPA.GetPort() );
+ CPPUNIT_ASSERT_EQUAL( (unsigned short) 0 , anIPA.GetPort() );
anIPA.GetInAddr(outval);
CPPUNIT_ASSERT( memcmp(&inval, &outval, sizeof(struct in_addr)) == 0 );
}
CPPUNIT_ASSERT( !anIPA.IsIPv4() );
CPPUNIT_ASSERT( anIPA.IsIPv6() );
CPPUNIT_ASSERT( !anIPA.IsSockAddr() );
- CPPUNIT_ASSERT_EQUAL( (u_short) 0 , anIPA.GetPort() );
+ CPPUNIT_ASSERT_EQUAL( (unsigned short) 0 , anIPA.GetPort() );
anIPA.GetInAddr(outval);
CPPUNIT_ASSERT( memcmp( &inval, &outval, sizeof(struct in6_addr)) == 0 );
}
CPPUNIT_ASSERT( anIPA.IsIPv4() );
CPPUNIT_ASSERT( !anIPA.IsIPv6() );
CPPUNIT_ASSERT( anIPA.IsSockAddr() );
- CPPUNIT_ASSERT_EQUAL( (u_short) 80 , anIPA.GetPort() );
+ CPPUNIT_ASSERT_EQUAL( (unsigned short) 80 , anIPA.GetPort() );
anIPA.GetSockAddr(outsock);
CPPUNIT_ASSERT( memcmp( &insock, &outsock, sizeof(struct sockaddr_in)) == 0 );
}
CPPUNIT_ASSERT( !anIPA.IsIPv4() );
CPPUNIT_ASSERT( anIPA.IsIPv6() );
CPPUNIT_ASSERT( anIPA.IsSockAddr() );
- CPPUNIT_ASSERT_EQUAL( (u_short) 80 , anIPA.GetPort() );
+ CPPUNIT_ASSERT_EQUAL( (unsigned short) 80 , anIPA.GetPort() );
anIPA.GetSockAddr(outsock);
CPPUNIT_ASSERT( memcmp( &insock, &outsock, sizeof(struct sockaddr_in6)) == 0 );
}
CPPUNIT_ASSERT( outIPA.IsIPv4() );
CPPUNIT_ASSERT( !outIPA.IsIPv6() );
CPPUNIT_ASSERT( outIPA.IsSockAddr() );
- CPPUNIT_ASSERT_EQUAL( (u_short) 80 , outIPA.GetPort() );
+ CPPUNIT_ASSERT_EQUAL( (unsigned short) 80 , outIPA.GetPort() );
outIPA.GetSockAddr(outsock);
CPPUNIT_ASSERT( memcmp( &insock, &outsock, sizeof(struct sockaddr_in)) == 0 );
}
CPPUNIT_ASSERT( anIPA.IsIPv4() );
CPPUNIT_ASSERT( !anIPA.IsIPv6() );
CPPUNIT_ASSERT( !anIPA.IsSockAddr() );
- CPPUNIT_ASSERT_EQUAL( (u_short) 0 , anIPA.GetPort() );
+ CPPUNIT_ASSERT_EQUAL( (unsigned short) 0 , anIPA.GetPort() );
anIPA.GetInAddr(outval);
CPPUNIT_ASSERT( memcmp( &expectval, &outval, sizeof(struct in_addr)) == 0 );
}
CPPUNIT_ASSERT( !anIPA.IsNoAddr() );
CPPUNIT_ASSERT( anIPA.IsIPv4() );
CPPUNIT_ASSERT( !anIPA.IsIPv6() );
- CPPUNIT_ASSERT_EQUAL( (u_short) 0 , anIPA.GetPort() );
+ CPPUNIT_ASSERT_EQUAL( (unsigned short) 0 , anIPA.GetPort() );
CPPUNIT_ASSERT( !anIPA.IsSockAddr() );
anIPA.GetInAddr(outval);
CPPUNIT_ASSERT( memcmp( &expectval, &outval, sizeof(struct in_addr)) == 0 );
CPPUNIT_ASSERT( !bnIPA.IsIPv4() );
CPPUNIT_ASSERT( bnIPA.IsIPv6() );
CPPUNIT_ASSERT( !bnIPA.IsSockAddr() );
- CPPUNIT_ASSERT_EQUAL( (u_short) 0 , bnIPA.GetPort() );
+ CPPUNIT_ASSERT_EQUAL( (unsigned short) 0 , bnIPA.GetPort() );
bnIPA.GetInAddr(outval6);
CPPUNIT_ASSERT( memcmp( &expectv6, &outval6, sizeof(struct in6_addr)) == 0 );
CPPUNIT_ASSERT( !cnIPA.IsIPv4() );
CPPUNIT_ASSERT( cnIPA.IsIPv6() );
CPPUNIT_ASSERT( !cnIPA.IsSockAddr() );
- CPPUNIT_ASSERT_EQUAL( (u_short) 0 , cnIPA.GetPort() );
+ CPPUNIT_ASSERT_EQUAL( (unsigned short) 0 , cnIPA.GetPort() );
cnIPA.GetInAddr(outval6);
CPPUNIT_ASSERT( memcmp( &expectv6, &outval6, sizeof(struct in6_addr)) == 0 );
}
CPPUNIT_ASSERT( anIPA.IsIPv4() );
CPPUNIT_ASSERT( !anIPA.IsIPv6() );
CPPUNIT_ASSERT( !anIPA.IsSockAddr() );
- CPPUNIT_ASSERT_EQUAL( (u_short) 0 , anIPA.GetPort() );
+ CPPUNIT_ASSERT_EQUAL( (unsigned short) 0 , anIPA.GetPort() );
anIPA.SetEmpty();
CPPUNIT_ASSERT( anIPA.IsIPv4() );
CPPUNIT_ASSERT( anIPA.IsIPv6() );
CPPUNIT_ASSERT( !anIPA.IsSockAddr() );
- CPPUNIT_ASSERT_EQUAL( (u_short) 0 , anIPA.GetPort() );
+ CPPUNIT_ASSERT_EQUAL( (unsigned short) 0 , anIPA.GetPort() );
}
void
CPPUNIT_ASSERT( !anIPA.IsNoAddr() );
CPPUNIT_ASSERT( anIPA.IsIPv4() );
CPPUNIT_ASSERT( !anIPA.IsIPv6() );
- CPPUNIT_ASSERT_EQUAL( (u_short) 0 , anIPA.GetPort() );
+ CPPUNIT_ASSERT_EQUAL( (unsigned short) 0 , anIPA.GetPort() );
CPPUNIT_ASSERT( !anIPA.IsSockAddr() );
anIPA.GetInAddr(outval);
CPPUNIT_ASSERT( memcmp( &expectval, &outval, sizeof(struct in_addr)) == 0 );
CPPUNIT_ASSERT( !anIPA.IsNoAddr() );
CPPUNIT_ASSERT( anIPA.IsIPv4() );
CPPUNIT_ASSERT( !anIPA.IsIPv6() );
- CPPUNIT_ASSERT_EQUAL( (u_short) 0 , anIPA.GetPort() );
+ CPPUNIT_ASSERT_EQUAL( (unsigned short) 0 , anIPA.GetPort() );
CPPUNIT_ASSERT( !anIPA.IsSockAddr() );
anIPA.GetInAddr(outval);
CPPUNIT_ASSERT( memcmp( &expectval, &outval, sizeof(struct in_addr)) == 0 );
CPPUNIT_ASSERT( !anIPA.IsNoAddr() );
CPPUNIT_ASSERT( anIPA.IsIPv4() );
CPPUNIT_ASSERT( !anIPA.IsIPv6() );
- CPPUNIT_ASSERT_EQUAL( (u_short) 0 , anIPA.GetPort() );
+ CPPUNIT_ASSERT_EQUAL( (unsigned short) 0 , anIPA.GetPort() );
CPPUNIT_ASSERT( !anIPA.IsSockAddr() );
anIPA.GetInAddr(outval);
CPPUNIT_ASSERT( memcmp( &expectval, &outval, sizeof(struct in_addr)) == 0 );
CPPUNIT_ASSERT( !anIPA.IsNoAddr() );
CPPUNIT_ASSERT( anIPA.IsIPv4() );
CPPUNIT_ASSERT( !anIPA.IsIPv6() );
- CPPUNIT_ASSERT_EQUAL( (u_short) 0 , anIPA.GetPort() );
+ CPPUNIT_ASSERT_EQUAL( (unsigned short) 0 , anIPA.GetPort() );
CPPUNIT_ASSERT( !anIPA.IsSockAddr() );
anIPA.GetInAddr(outval);
CPPUNIT_ASSERT( memcmp( &expectval, &outval, sizeof(struct in_addr)) == 0 );
setEffectiveUser();
if (icpPortNumOverride != 1)
- Config.Port.icp = (u_short) icpPortNumOverride;
+ Config.Port.icp = (unsigned short) icpPortNumOverride;
_db_init(Debug::cache_log, Debug::debugOptions);
static void dump_peers(StoreEntry * sentry, peer * peers);
static icp_common_t echo_hdr;
-static u_short echo_port;
+static unsigned short echo_port;
static int NLateReplies = 0;
static peer *first_ping = NULL;
nul = *AI;
nul.GetInAddr( *((struct in_addr*)&echo_hdr.shostid) );
sep = getservbyname("echo", "udp");
- echo_port = sep ? ntohs((u_short) sep->s_port) : 7;
+ echo_port = sep ? ntohs((unsigned short) sep->s_port) : 7;
}
first_ping = Config.peers;
/* ========== PconnPool PRIVATE FUNCTIONS ============================================ */
const char *
-PconnPool::key(const char *host, u_short port, const char *domain, IpAddress &client_address)
+PconnPool::key(const char *host, unsigned 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, unsigned short port, const char *domain, IpAddress &client_address)
{
IdleConnList *list;
const char *aKey;
* 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, unsigned short port, const char *domain, IpAddress &client_address, bool isRetriable)
{
const char * aKey = key(host, port, domain, client_address);
~PconnPool();
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, unsigned short port, const char *domain, IpAddress &client_address);
+ int pop(const char *host, unsigned 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, unsigned short port, const char *domain, IpAddress &client_address);
int hist[PCONN_HIST_SZ];
hash_table *table;
SQUIDCEXTERN const char *urlCanonicalFakeHttps(const HttpRequest * request);
SQUIDCEXTERN bool urlIsRelative(const char *);
SQUIDCEXTERN char *urlMakeAbsolute(const HttpRequest *, const char *);
-SQUIDCEXTERN char *urlRInternal(const char *host, u_short port, const char *dir, const char *name);
+SQUIDCEXTERN char *urlRInternal(const char *host, unsigned short port, const char *dir, const char *name);
SQUIDCEXTERN char *urlInternal(const char *dir, const char *name);
SQUIDCEXTERN int matchDomainName(const char *host, const char *domain);
SQUIDCEXTERN int urlCheckRequest(const HttpRequest *);
SQUIDCEXTERN int internalCheck(const char *urlpath);
SQUIDCEXTERN int internalStaticCheck(const char *urlpath);
SQUIDCEXTERN char *internalLocalUri(const char *dir, const char *name);
-SQUIDCEXTERN char *internalRemoteUri(const char *, u_short, const char *, const char *);
+SQUIDCEXTERN char *internalRemoteUri(const char *, unsigned short, const char *, const char *);
SQUIDCEXTERN const char *internalHostname(void);
SQUIDCEXTERN int internalHostnameIs(const char *);
IpAddress S;
char *host = Config.Announce.host;
char *file = NULL;
- u_short port = Config.Announce.port;
+ unsigned short port = Config.Announce.port;
int l;
int n;
int fd;
};
struct ushortlist {
- u_short i;
+ unsigned short i;
ushortlist *next;
};
acl_size_t *ReplyBodySize;
struct {
- u_short icp;
+ unsigned short icp;
#if USE_HTCP
- u_short htcp;
+ unsigned short htcp;
#endif
#if SQUID_SNMP
- u_short snmp;
+ unsigned short snmp;
#endif
} Port;
char *host;
char *file;
time_t period;
- u_short port;
+ unsigned short port;
} Announce;
struct {
struct {
int version;
int counts[ICP_END+1];
- u_short port;
+ unsigned short port;
} icp;
#if USE_HTCP
struct {
double version;
int counts[2];
- u_short port;
+ unsigned short port;
} htcp;
#endif
- u_short http_port;
+ unsigned short http_port;
domain_ping *peer_domain;
domain_type *typelist;
acl_access *access;
}
void
-ConfigParser::ParseUShort(u_short *var)
+ConfigParser::ParseUShort(unsigned short *var)
{
fatal("not implemented 10");
}
testHttpRequest::testCreateFromUrlAndMethod()
{
/* vanilla url */
- ushort expected_port;
+ unsigned short expected_port;
char * url = xstrdup("http://foo:90/bar");
HttpRequest *aRequest = HttpRequest::CreateFromUrlAndMethod(url, METHOD_GET);
expected_port = 90;
testHttpRequest::testCreateFromUrl()
{
/* vanilla url */
- ushort expected_port;
+ unsigned short expected_port;
char * url = xstrdup("http://foo:90/bar");
HttpRequest *aRequest = HttpRequest::CreateFromUrl(url);
expected_port = 90;
void
testHttpRequest::testIPv6HostColonBug()
{
- ushort expected_port;
+ unsigned short expected_port;
char * url = NULL;
HttpRequest *aRequest = NULL;
bool noConnections() const;
char *url;
char *host; /* either request->host or proxy host */
- u_short port;
+ unsigned short port;
HttpRequest *request;
FwdServer *servers;
time_t expires;
time_t lastmod;
size_t swap_file_sz;
- u_short refcount;
- u_short flags;
+ uint16_t refcount;
+ uint16_t flags;
};
struct MetaStdLfs {
time_t expires;
time_t lastmod;
uint64_t swap_file_sz;
- u_short refcount;
- u_short flags;
+ uint16_t refcount;
+ uint16_t flags;
};
struct DumpStoreMeta : public unary_function<StoreMeta, void> {
request->SetHost(host);
xstrncpy(request->login, login, MAX_LOGIN_SZ);
- request->port = (u_short) port;
+ request->port = (unsigned short) port;
return request;
}
int router_len;
int bucket_counter;
uint32_t service_flags;
- u_short port = WCCP_PORT;
+ unsigned short port = WCCP_PORT;
/* Packet segments */