From 09aabd845268c817d95d6139e7680800fe5b42b2 Mon Sep 17 00:00:00 2001 From: Francesco Chemolli Date: Tue, 6 Jul 2010 14:44:06 +0200 Subject: [PATCH] u_int*_t types renamed to the more widely used uint*_t --- compat/types.h | 72 ++++++++++--------- configure.in | 45 ++++++------ .../02_CodingConventions.dox | 6 +- .../basic_auth/RADIUS/basic_radius_auth.cc | 8 +-- helpers/basic_auth/RADIUS/radius-util.cc | 20 +++--- helpers/basic_auth/RADIUS/radius-util.h | 2 +- helpers/ntlm_auth/SSPI/ntlm_sspi_auth.cc | 2 +- helpers/ntlm_auth/smb_lm/ntlm_smb_lm_auth.cc | 12 ++-- include/squid_endian.h | 30 ++++---- lib/getnameinfo.c | 4 +- lib/strtoll.c | 10 +-- libntlmauth/ntlmauth.cc | 6 +- libntlmauth/ntlmauth.h | 14 ++-- src/CacheDigest.cc | 2 +- src/ICP.h | 8 +-- src/fs/coss/store_dir_coss.cc | 8 +-- src/fs/ufs/store_dir_ufs.cc | 4 +- src/fs/ufs/ufscommon.h | 4 +- src/htcp.cc | 64 ++++++++--------- src/htcp.h | 2 +- src/icmp/Icmp.cc | 2 +- src/icmp/Icmp.h | 2 +- src/icmp/Icmp4.h | 34 ++++----- src/icp_v2.cc | 14 ++-- src/icp_v3.cc | 2 +- src/wccp2.cc | 4 +- 26 files changed, 193 insertions(+), 188 deletions(-) diff --git a/compat/types.h b/compat/types.h index eb3eb95bd3..66adb85e18 100644 --- a/compat/types.h +++ b/compat/types.h @@ -129,14 +129,16 @@ typedef long long int64_t; #endif #endif -/* u_int64_t */ -#ifndef HAVE_U_INT64_T -#if HAVE_UINT64_T -typedef uint64_t u_int64_t; -#else -typedef unsigned int64_t u_int64_t; -#endif -#endif +/* uint64_t */ +#if !HAVE_UINT64_T +#if HAVE_U_INT64_T +typedef u_int64_t uint64_t; +#define HAVE_UINT64_T 1 +#elif HAVE_INT64_T +typedef unsigned int64_t uint64_t; +#define HAVE_UINT64_T 1 +#endif /* HAVE_U_INT64_T */ +#endif /* HAVE_UINT64_T */ /* int32_t */ #ifndef HAVE_INT32_T @@ -149,14 +151,16 @@ typedef long int32_t; #endif #endif -/* u_int32_t */ -#ifndef HAVE_U_INT32_T -#if HAVE_UINT32_T -typedef uint32_t u_int32_t; -#else -typedef unsigned int32_t u_int32_t; -#endif -#endif +/* uint32_t */ +#if !HAVE_UINT32_T +#if HAVE_U_INT32_T +typedef u_int32_t uint32_t; +#define HAVE_UINT32_T 1 +#elif HAVE_INT32_T +typedef unsigned int32_t uint32_t; +#define HAVE_UINT32_T 1 +#endif /* HAVE_U_INT32_T */ +#endif /* HAVE_UINT32_T */ /* int16_t */ #ifndef HAVE_INT16_T @@ -169,14 +173,16 @@ typedef int int16_t; #endif #endif -/* u_int16_t */ -#ifndef HAVE_U_INT16_T -#if HAVE_UINT16_T -typedef uint16_t u_int16_t; -#else -typedef unsigned int16_t u_int16_t; -#endif -#endif +/* uint16_t */ +#if !HAVE_UINT16_T +#if HAVE_U_INT16_T +typedef u_int16_t uint16_t; +#define HAVE_UINT16_T 1 +#elif HAVE_INT16_T +typedef unsigned int16_t uint16_t; +#define HAVE_UINT16_T 1 +#endif /* HAVE_U_INT16_T */ +#endif /* HAVE_UINT16_T */ /* int8_t */ #ifndef HAVE_INT8_T @@ -187,14 +193,16 @@ typedef char int8_t; #endif #endif -/* u_int8_t */ -#ifndef HAVE_U_INT8_T -#if HAVE_UINT8_T -typedef uint8_t u_int8_t; -#else -typedef unsigned char u_int8_t; -#endif -#endif +/* uint8_t */ +#if !HAVE_UINT8_T +#if HAVE_U_INT8_T +typedef u_int8_t uint8_t; +#define HAVE_UINT8_T 1 +#elif HAVE_INT8_T +typedef unsigned int8_t uint8_t; +#define HAVE_UINT8_T 1 +#endif /* HAVE_U_INT8_T */ +#endif /* HAVE_UINT8_T */ #ifndef HAVE_PID_T #if defined(_MSC_VER) /* Microsoft C Compiler ONLY */ diff --git a/configure.in b/configure.in index 0480555256..38444d4e15 100644 --- a/configure.in +++ b/configure.in @@ -2350,18 +2350,17 @@ AC_CHECK_TYPE(char,[ dnl unsigned 8 bit ints - u_int8_t dnl if this is defined we trust it to be 8 bits -AC_CHECK_TYPE(u_int8_t,[ - AC_CHECK_SIZEOF(u_int8_t,,SQUID_DEFAULT_SIZEOF_INCLUDES) - AC_DEFINE(HAVE_U_INT8_T,1,[u_int8_t is defined in system headers]) - ],,SQUID_DEFAULT_INCLUDES) - -dnl fallback #1 -dnl if this is defined we trust it to be 8 bits AC_CHECK_TYPE(uint8_t,[ AC_CHECK_SIZEOF(uint8_t,,SQUID_DEFAULT_SIZEOF_INCLUDES) AC_DEFINE(HAVE_UINT8_T,1,[uint8_t is defined in system headers]) ],,SQUID_DEFAULT_INCLUDES) +dnl if this is defined we trust it to be 8 bits +AC_CHECK_TYPE(u_int8_t,[ + AC_CHECK_SIZEOF(u_int8_t,,SQUID_DEFAULT_SIZEOF_INCLUDES) + AC_DEFINE(HAVE_U_INT8_T,1,[u_int8_t is defined in system headers]) + ],,SQUID_DEFAULT_INCLUDES) + dnl 16 bit integers - int16_t dnl if this is defined we trust it to be 16 bits AC_CHECK_TYPE(int16_t,[ @@ -2381,20 +2380,19 @@ AC_CHECK_TYPE(int,[ AC_DEFINE(HAVE_INT,1,[int is defined in system headers]) ],,SQUID_DEFAULT_INCLUDES) -dnl unsigned 16 bit ints - u_int16_t -dnl if this is defined we trust it to be 16 bits -AC_CHECK_TYPE(u_int16_t,[ - AC_CHECK_SIZEOF(u_int16_t,,SQUID_DEFAULT_SIZEOF_INCLUDES) - AC_DEFINE(HAVE_U_INT16_T,1,[u_int16_t is defined in system headers]) - ],,SQUID_DEFAULT_INCLUDES) - -dnl fallback #1 +dnl unsigned 16 bit ints - uint16_t dnl if this is defined we trust it to be 16 bits AC_CHECK_TYPE(uint16_t,[ AC_CHECK_SIZEOF(uint16_t,,SQUID_DEFAULT_SIZEOF_INCLUDES) AC_DEFINE(HAVE_UINT16_T,1,[uint16_t is defined in system headers]) ],,SQUID_DEFAULT_INCLUDES) +dnl if this is defined we trust it to be 16 bits +AC_CHECK_TYPE(u_int16_t,[ + AC_CHECK_SIZEOF(u_int16_t,,SQUID_DEFAULT_SIZEOF_INCLUDES) + AC_DEFINE(HAVE_U_INT16_T,1,[u_int16_t is defined in system headers]) + ],,SQUID_DEFAULT_INCLUDES) + dnl 32 bit signed int - int32_t dnl if this is defined we trust it to be 32 bits AC_CHECK_TYPE(int32_t,[ @@ -2408,20 +2406,19 @@ AC_CHECK_TYPE(long,[ AC_DEFINE(HAVE_LONG,1,[long is defined in system headers]) ],,SQUID_DEFAULT_INCLUDES) -dnl 32 bit unsigned int - u_int32_t -dnl if this is defined we trust it to be 32 bits -AC_CHECK_TYPE(u_int32_t,[ - AC_CHECK_SIZEOF(u_int32_t,,SQUID_DEFAULT_SIZEOF_INCLUDES) - AC_DEFINE(HAVE_U_INT32_T,1,[u_int32_t is defined in system headers]) - ],,SQUID_DEFAULT_INCLUDES) - -dnl fallback #1 +dnl 32 bit unsigned int - uint32_t dnl if this is defined we trust it to be 32 bits AC_CHECK_TYPE(uint32_t,[ AC_CHECK_SIZEOF(uint32_t,,SQUID_DEFAULT_SIZEOF_INCLUDES) AC_DEFINE(HAVE_UINT32_T,1,[uint32_t is defined in system headers]) ],,SQUID_DEFAULT_INCLUDES) +dnl if this is defined we trust it to be 32 bits +AC_CHECK_TYPE(u_int32_t,[ + AC_CHECK_SIZEOF(u_int32_t,,SQUID_DEFAULT_SIZEOF_INCLUDES) + AC_DEFINE(HAVE_U_INT32_T,1,[u_int32_t is defined in system headers]) + ],,SQUID_DEFAULT_INCLUDES) + dnl 64 bit signed - int64_t dnl if this is defind we trust it to be 64 bits AC_CHECK_TYPE(int64_t,[ @@ -2449,7 +2446,7 @@ AC_CHECK_TYPE(u_int64_t,[ AC_DEFINE(HAVE_U_INT64_T,1,[u_int64_t is defined in system headers]) ],,SQUID_DEFAULT_INCLUDES) -dnl fallback #1 +dnl 64 bit unsigned - uint64_t dnl if this is defind we trust it to be 64 bits AC_CHECK_TYPE(uint64_t,[ AC_CHECK_SIZEOF(uint64_t,,SQUID_DEFAULT_SIZEOF_INCLUDES) diff --git a/doc/Programming-Guide/02_CodingConventions.dox b/doc/Programming-Guide/02_CodingConventions.dox index defc6f8fc9..bb99c8d2f8 100644 --- a/doc/Programming-Guide/02_CodingConventions.dox +++ b/doc/Programming-Guide/02_CodingConventions.dox @@ -15,11 +15,11 @@ \verbatim int16_t - 16 bit signed. - u_int16_t - 16 bit unsigned. + uint16_t - 16 bit unsigned. int32_t - 32 bit signed. - u_int32_t - 32 bit unsigned. + uint32_t - 32 bit unsigned. int64_t - 64 bit signed. - u_int64_t - 64 bit unsigned. + uint64_t - 64 bit unsigned. \endverbatim \section Documentation Documentation Conventions diff --git a/helpers/basic_auth/RADIUS/basic_radius_auth.cc b/helpers/basic_auth/RADIUS/basic_radius_auth.cc index 94a6f0b4a5..5b2228a03c 100644 --- a/helpers/basic_auth/RADIUS/basic_radius_auth.cc +++ b/helpers/basic_auth/RADIUS/basic_radius_auth.cc @@ -114,8 +114,8 @@ static char identifier[MAXLINE] = ""; static char svc_name[MAXLINE] = "radius"; static int nasport = 111; static int nasporttype = 0; -static u_int32_t nas_ipaddr; -static u_int32_t auth_ipaddr; +static uint32_t nas_ipaddr; +static uint32_t auth_ipaddr; static int retries = 30; char progname[] = "basic_radius_auth"; @@ -166,7 +166,7 @@ md5_calc(uint8_t out[16], void *in, size_t len) * 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, u_short udp_port, char *buffer, int length) { AUTH_HDR *auth; int totallen; @@ -288,7 +288,7 @@ authenticate(int socket_fd, const char *username, const char *passwd) int secretlen; u_char cbc[AUTH_VECTOR_LEN]; int i, j; - u_int32_t ui; + uint32_t ui; struct sockaddr_in saremote; fd_set readfds; socklen_t salen; diff --git a/helpers/basic_auth/RADIUS/radius-util.cc b/helpers/basic_auth/RADIUS/radius-util.cc index d040766be6..bcc28f8d8b 100644 --- a/helpers/basic_auth/RADIUS/radius-util.cc +++ b/helpers/basic_auth/RADIUS/radius-util.cc @@ -102,37 +102,37 @@ static int good_ipaddr(char *addr) * Return an IP address in host long notation from * one supplied in standard dot notation. */ -static u_int32_t ipstr2long(char *ip_str) +static uint32_t ipstr2long(char *ip_str) { char buf[6]; char *ptr; int i; int count; - u_int32_t ipaddr; + uint32_t ipaddr; int cur_byte; - ipaddr = (u_int32_t)0; + ipaddr = (uint32_t)0; for (i = 0; i < 4; i++) { ptr = buf; count = 0; *ptr = '\0'; while (*ip_str != '.' && *ip_str != '\0' && count < 4) { if (!isdigit(*ip_str)) { - return((u_int32_t)0); + return((uint32_t)0); } *ptr++ = *ip_str++; count++; } if (count >= 4 || count == 0) { - return((u_int32_t)0); + return((uint32_t)0); } *ptr = '\0'; cur_byte = atoi(buf); if (cur_byte < 0 || cur_byte > 255) { - return((u_int32_t)0); + return((uint32_t)0); } ip_str++; - ipaddr = ipaddr << 8 | (u_int32_t)cur_byte; + ipaddr = ipaddr << 8 | (uint32_t)cur_byte; } return(ipaddr); } @@ -141,14 +141,14 @@ static u_int32_t ipstr2long(char *ip_str) * Return an IP address in host long notation from a host * name or address in dot notation. */ -u_int32_t get_ipaddr(char *host) +uint32_t get_ipaddr(char *host) { struct hostent *hp; if (good_ipaddr(host) == 0) { return(ipstr2long(host)); } else if ((hp = gethostbyname(host)) == (struct hostent *)NULL) { - return((u_int32_t)0); + return((uint32_t)0); } - return(ntohl(*(u_int32_t *)hp->h_addr)); + return(ntohl(*(uint32_t *)hp->h_addr)); } diff --git a/helpers/basic_auth/RADIUS/radius-util.h b/helpers/basic_auth/RADIUS/radius-util.h index ee16bfe1e5..5234e87de1 100644 --- a/helpers/basic_auth/RADIUS/radius-util.h +++ b/helpers/basic_auth/RADIUS/radius-util.h @@ -4,4 +4,4 @@ #include "util.h" /* util.c */ -u_int32_t get_ipaddr (char *); +uint32_t get_ipaddr (char *); diff --git a/helpers/ntlm_auth/SSPI/ntlm_sspi_auth.cc b/helpers/ntlm_auth/SSPI/ntlm_sspi_auth.cc index 0d7739b3cb..11494612a1 100644 --- a/helpers/ntlm_auth/SSPI/ntlm_sspi_auth.cc +++ b/helpers/ntlm_auth/SSPI/ntlm_sspi_auth.cc @@ -489,7 +489,7 @@ try_again: if (strlen(buf) > 3) plen = (strlen(buf) - 3) * 3 / 4; /* we only need it here. Optimization */ else - plen = sizeof(ntlmhdr) + sizeof u_int32_t); /* local_nego only has header and flags set. */ + plen = sizeof(ntlmhdr) + sizeof uint32_t); /* local_nego only has header and flags set. */ debug("attempting SSPI challenge retrieval\n"); if ((c = (char *) SSP_MakeChallenge((ntlm_negotiate *) decoded, plen)) != NULL ) { if (NTLM_packet_debug_enabled) { diff --git a/helpers/ntlm_auth/smb_lm/ntlm_smb_lm_auth.cc b/helpers/ntlm_auth/smb_lm/ntlm_smb_lm_auth.cc index 45be55f613..2bd9a0d316 100644 --- a/helpers/ntlm_auth/smb_lm/ntlm_smb_lm_auth.cc +++ b/helpers/ntlm_auth/smb_lm/ntlm_smb_lm_auth.cc @@ -223,12 +223,12 @@ make_challenge(char *domain, char *domain_controller) return NULL; } ntlm_challenge chal; - u_int32_t flags = NTLM_REQUEST_NON_NT_SESSION_KEY | - NTLM_CHALLENGE_TARGET_IS_DOMAIN | - NTLM_NEGOTIATE_ALWAYS_SIGN | - NTLM_NEGOTIATE_USE_NTLM | - NTLM_NEGOTIATE_USE_LM | - NTLM_NEGOTIATE_ASCII; + uint32_t flags = NTLM_REQUEST_NON_NT_SESSION_KEY | + NTLM_CHALLENGE_TARGET_IS_DOMAIN | + NTLM_NEGOTIATE_ALWAYS_SIGN | + NTLM_NEGOTIATE_USE_NTLM | + NTLM_NEGOTIATE_USE_LM | + NTLM_NEGOTIATE_ASCII; ntlm_make_challenge(&chal, my_domain, my_domain_controller, (char *)challenge, NTLM_NONCE_LEN, flags); int len = sizeof(chal) - sizeof(chal.payload) + le16toh(chal.target.maxlen); return base64_encode_bin((char *)&chal, len); diff --git a/include/squid_endian.h b/include/squid_endian.h index 35280108e1..54e0f9a6b8 100644 --- a/include/squid_endian.h +++ b/include/squid_endian.h @@ -39,20 +39,20 @@ * the following interface: * * // Byte-swap - * u_int16_t bswap16(u_int16_t); - * u_int32_t bswap32(u_int32_t); + * uint16_t bswap16(uint16_t); + * uint32_t bswap32(uint32_t); * * // Convert from host byte order to big-endian, and vice versa. - * u_int16_t htobe16(u_int16_t); // equivalent to htons() - * u_int32_t htobe32(u_int32_t); // equivalent to htonl() - * u_int16_t be16toh(u_int16_t); // equivalent to ntohs() - * u_int32_t be32toh(u_int32_t); // equivalent to ntohs() + * uint16_t htobe16(uint16_t); // equivalent to htons() + * uint32_t htobe32(uint32_t); // equivalent to htonl() + * uint16_t be16toh(uint16_t); // equivalent to ntohs() + * uint32_t be32toh(uint32_t); // equivalent to ntohs() * * // Convert from host byte order to little-endian, and vice versa. - * u_int16_t htole16(u_int16_t); - * u_int32_t htole32(u_int32_t); - * u_int16_t le16toh(u_int16_t); - * u_int32_t le32toh(u_int32_t); + * uint16_t htole16(uint16_t); + * uint32_t htole32(uint32_t); + * uint16_t le16toh(uint16_t); + * uint32_t le32toh(uint32_t); */ #include "config.h" @@ -86,7 +86,7 @@ # define bswap16(x) bswap_16(x) # else # define bswap16(x) \ - (((((u_int16_t)(x)) >> 8) & 0xff) | ((((u_int16_t)(x)) & 0xff) << 8)) + (((((uint16_t)(x)) >> 8) & 0xff) | ((((uint16_t)(x)) & 0xff) << 8)) # endif #endif /* ! HAVE_BSWAP16 && ! defined(bswap16) */ #if ! HAVE_BSWAP32 && ! defined(bswap32) @@ -94,10 +94,10 @@ # define bswap32(x) bswap_32(x) # else # define bswap32(x) \ - (((((u_int32_t)(x)) & 0xff000000) >> 24) | \ - ((((u_int32_t)(x)) & 0x00ff0000) >> 8) | \ - ((((u_int32_t)(x)) & 0x0000ff00) << 8) | \ - ((((u_int32_t)(x)) & 0x000000ff) << 24)) + (((((uint32_t)(x)) & 0xff000000) >> 24) | \ + ((((uint32_t)(x)) & 0x00ff0000) >> 8) | \ + ((((uint32_t)(x)) & 0x0000ff00) << 8) | \ + ((((uint32_t)(x)) & 0x000000ff) << 24)) # endif #endif /* ! HAVE_BSWAP32 && ! defined(bswap32) */ diff --git a/lib/getnameinfo.c b/lib/getnameinfo.c index 16aba171ce..2d3d135b1f 100644 --- a/lib/getnameinfo.c +++ b/lib/getnameinfo.c @@ -162,7 +162,7 @@ int flags; u_short port; int family, i; const char *addr; - u_int32_t v4a; + uint32_t v4a; int h_error; char numserv[512]; @@ -218,7 +218,7 @@ found: switch (sa->sa_family) { case AF_INET: - v4a = (u_int32_t) + v4a = (uint32_t) ntohl(((const struct sockaddr_in *)sa)->sin_addr.s_addr); if (IN_MULTICAST(v4a) || IN_EXPERIMENTAL(v4a)) flags |= NI_NUMERICHOST; diff --git a/lib/strtoll.c b/lib/strtoll.c index 666b0828d3..da7fc5fb35 100644 --- a/lib/strtoll.c +++ b/lib/strtoll.c @@ -75,9 +75,9 @@ int64_t strtoll (const char *nptr, char **endptr, int base) { register const char *s = nptr; - register u_int64_t acc; + register uint64_t acc; register int c; - register u_int64_t cutoff; + register uint64_t cutoff; register int neg = 0, any, cutlim; /* @@ -118,9 +118,9 @@ strtoll (const char *nptr, char **endptr, int base) * Set any if any `digits' consumed; make it negative to indicate * overflow. */ - cutoff = neg ? -(u_int64_t) INT64_MIN : INT64_MAX; - cutlim = cutoff % (u_int64_t) base; - cutoff /= (u_int64_t) base; + cutoff = neg ? -(uint64_t) INT64_MIN : INT64_MAX; + cutlim = cutoff % (uint64_t) base; + cutoff /= (uint64_t) base; for (acc = 0, any = 0;; c = *s++) { if (xisdigit(c)) c -= '0'; diff --git a/libntlmauth/ntlmauth.cc b/libntlmauth/ntlmauth.cc index 553e1c25e4..03f3b58e22 100644 --- a/libntlmauth/ntlmauth.cc +++ b/libntlmauth/ntlmauth.cc @@ -43,7 +43,7 @@ /** Dumps NTLM flags to standard error for debugging purposes */ void -ntlm_dump_ntlmssp_flags(u_int32_t flags) +ntlm_dump_ntlmssp_flags(uint32_t flags) { fprintf(stderr, "flags: %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", (flags & NTLM_NEGOTIATE_UNICODE ? "Unicode " : ""), @@ -113,7 +113,7 @@ ntlm_validate_packet(const ntlmhdr * hdr, const int type) * String may be either ASCII or UNICODE depending on whether flags contains NTLM_NEGOTIATE_ASCII */ lstring -ntlm_fetch_string(const ntlmhdr *packet, const int32_t packet_size, const strhdr * str, const u_int32_t flags) +ntlm_fetch_string(const ntlmhdr *packet, const int32_t packet_size, const strhdr * str, const uint32_t flags) { int16_t l; /* length */ int32_t o; /* offset */ @@ -225,7 +225,7 @@ void ntlm_make_challenge(ntlm_challenge *ch, const char *domain, const char *domain_controller_UNUSED, const char *challenge_nonce, const int challenge_nonce_len, - const u_int32_t flags) + const uint32_t flags) { int pl = 0; memset(ch, 0, sizeof(ntlm_challenge)); /* reset */ diff --git a/libntlmauth/ntlmauth.h b/libntlmauth/ntlmauth.h index 93c62d7d35..a55e178983 100644 --- a/libntlmauth/ntlmauth.h +++ b/libntlmauth/ntlmauth.h @@ -108,7 +108,7 @@ extern "C" { } lstring; /** Debug dump the given flags field to stderr */ - void ntlm_dump_ntlmssp_flags(const u_int32_t flags); + void ntlm_dump_ntlmssp_flags(const uint32_t flags); /* ************************************************************************* */ @@ -136,7 +136,7 @@ extern "C" { lstring ntlm_fetch_string(const ntlmhdr *packet, const int32_t packet_length, const strhdr *str, - const u_int32_t flags); + const uint32_t flags); /** Append a string to the NTLM packet payload. */ void ntlm_add_to_payload(const ntlmhdr *packet_hdr, @@ -169,7 +169,7 @@ extern "C" { /** Negotiation request sent by client */ typedef struct _ntlm_negotiate { ntlmhdr hdr; /**< "NTLMSSP" , LSWAP(0x1) */ - u_int32_t flags; /**< Request flags */ + uint32_t flags; /**< Request flags */ strhdr domain; /**< Domain we wish to authenticate in */ strhdr workstation; /**< Client workstation name */ char payload[256]; /**< String data */ @@ -191,10 +191,10 @@ extern "C" { typedef struct _ntlm_challenge { ntlmhdr hdr; /**< "NTLMSSP" , LSWAP(0x2) */ strhdr target; /**< Authentication target (domain/server ...) */ - u_int32_t flags; /**< Request flags */ + uint32_t flags; /**< Request flags */ u_char challenge[NTLM_NONCE_LEN]; /**< Challenge string */ - u_int32_t context_low; /**< LS part of the server context handle */ - u_int32_t context_high; /**< MS part of the server context handle */ + uint32_t context_low; /**< LS part of the server context handle */ + uint32_t context_high; /**< MS part of the server context handle */ char payload[256]; /**< String data */ } ntlm_challenge; @@ -210,7 +210,7 @@ extern "C" { const char *domain_controller, const char *challenge_nonce, const int challenge_nonce_len, - const u_int32_t flags); + const uint32_t flags); /* ************************************************************************* */ diff --git a/src/CacheDigest.cc b/src/CacheDigest.cc index 7f290ae835..6f0988abba 100644 --- a/src/CacheDigest.cc +++ b/src/CacheDigest.cc @@ -51,7 +51,7 @@ typedef struct { static void cacheDigestHashKey(const CacheDigest * cd, const cache_key * key); /* static array used by cacheDigestHashKey for optimization purposes */ -static u_int32_t hashed_keys[4]; +static uint32_t hashed_keys[4]; static void cacheDigestInit(CacheDigest * cd, int capacity, int bpe) diff --git a/src/ICP.h b/src/ICP.h index a1f1db3713..c7d898208d 100644 --- a/src/ICP.h +++ b/src/ICP.h @@ -55,11 +55,11 @@ struct _icp_common_t { /** total length (bytes) */ unsigned short length; /** req number (req'd for UDP) */ - u_int32_t reqnum; - u_int32_t flags; - u_int32_t pad; + uint32_t reqnum; + uint32_t flags; + uint32_t pad; /** sender host id */ - u_int32_t shostid; + uint32_t shostid; /// \todo I don't believe this header is included in non-c++ code anywhere /// the struct should become a public POD class and kill these ifdef. diff --git a/src/fs/coss/store_dir_coss.cc b/src/fs/coss/store_dir_coss.cc index bda27c7f05..64db7fe206 100644 --- a/src/fs/coss/store_dir_coss.cc +++ b/src/fs/coss/store_dir_coss.cc @@ -81,8 +81,8 @@ static StoreEntry *storeCossAddDiskRestore(CossSwapDir * SD, const cache_key * k time_t timestamp, time_t lastref, time_t lastmod, - u_int32_t refcount, - u_int16_t flags, + uint32_t refcount, + uint16_t flags, int clean); static void storeCossDirRebuild(CossSwapDir * sd); static void storeCossDirCloseTmpSwapLog(CossSwapDir * sd); @@ -511,8 +511,8 @@ storeCossAddDiskRestore(CossSwapDir * SD, const cache_key * key, time_t timestamp, time_t lastref, time_t lastmod, - u_int32_t refcount, - u_int16_t flags, + uint32_t refcount, + uint16_t flags, int clean) { StoreEntry *e = NULL; diff --git a/src/fs/ufs/store_dir_ufs.cc b/src/fs/ufs/store_dir_ufs.cc index 8f86832499..51df97615c 100644 --- a/src/fs/ufs/store_dir_ufs.cc +++ b/src/fs/ufs/store_dir_ufs.cc @@ -687,8 +687,8 @@ UFSSwapDir::addDiskRestore(const cache_key * key, time_t timestamp, time_t lastref, time_t lastmod, - u_int32_t refcount, - u_int16_t newFlags, + uint32_t refcount, + uint16_t newFlags, int clean) { StoreEntry *e = NULL; diff --git a/src/fs/ufs/ufscommon.h b/src/fs/ufs/ufscommon.h index 8d5363a180..bd3588c52d 100644 --- a/src/fs/ufs/ufscommon.h +++ b/src/fs/ufs/ufscommon.h @@ -96,8 +96,8 @@ public: time_t timestamp, time_t lastref, time_t lastmod, - u_int32_t refcount, - u_int16_t flags, + uint32_t refcount, + uint16_t flags, int clean); int validFileno(sfileno filn, int flag) const; int mapBitAllocate(); diff --git a/src/htcp.cc b/src/htcp.cc index fe6d507989..c6975e509c 100644 --- a/src/htcp.cc +++ b/src/htcp.cc @@ -62,18 +62,18 @@ typedef struct _htcpStuff htcpStuff; typedef struct _htcpDetail htcpDetail; struct _Countstr { - u_int16_t length; + uint16_t length; char *text; }; struct _htcpHeader { - u_int16_t length; + uint16_t length; u_char major; u_char minor; }; struct _htcpDataHeaderSquid { - u_int16_t length; + uint16_t length; #if !WORDS_BIGENDIAN unsigned int opcode:4; @@ -93,41 +93,41 @@ struct _htcpDataHeaderSquid { unsigned int reserved:6; #endif - u_int32_t msg_id; + uint32_t msg_id; }; struct _htcpDataHeader { - u_int16_t length; + uint16_t length; #if WORDS_BIGENDIAN -u_int8_t opcode: +uint8_t opcode: 4; -u_int8_t response: +uint8_t response: 4; #else -u_int8_t response: +uint8_t response: 4; -u_int8_t opcode: +uint8_t opcode: 4; #endif #if WORDS_BIGENDIAN -u_int8_t reserved: +uint8_t reserved: 6; -u_int8_t F1: +uint8_t F1: 1; -u_int8_t RR: +uint8_t RR: 1; #else -u_int8_t RR: +uint8_t RR: 1; -u_int8_t F1: +uint8_t F1: 1; -u_int8_t reserved: +uint8_t reserved: 6; #endif - u_int32_t msg_id; + uint32_t msg_id; }; /* RR == 0 --> F1 = RESPONSE DESIRED FLAG */ @@ -136,7 +136,7 @@ u_int8_t reserved: /* RR == 1 --> RESPONSE */ struct _htcpAuthHeader { - u_int16_t length; + uint16_t length; time_t sig_time; time_t sig_expire; Countstr key_name; @@ -182,7 +182,7 @@ struct _htcpStuff { int f1; int response; int reason; - u_int32_t msg_id; + uint32_t msg_id; htcpSpecifier S; htcpDetail D; }; @@ -225,11 +225,11 @@ enum { RR_RESPONSE }; -static u_int32_t msg_id_counter = 0; +static uint32_t msg_id_counter = 0; static int htcpInSocket = -1; static int htcpOutSocket = -1; #define N_QUERIED_KEYS 8192 -static u_int32_t queried_id[N_QUERIED_KEYS]; +static uint32_t queried_id[N_QUERIED_KEYS]; static cache_key queried_keys[N_QUERIED_KEYS][SQUID_MD5_DIGEST_LENGTH]; static Ip::Address queried_addr[N_QUERIED_KEYS]; @@ -306,7 +306,7 @@ htcpBuildAuth(char *buf, size_t buflen) { htcpAuthHeader auth; size_t copy_sz = 0; - assert(2 == sizeof(u_int16_t)); + assert(2 == sizeof(uint16_t)); auth.length = htons(2); copy_sz += 2; if (buflen < copy_sz) @@ -318,7 +318,7 @@ htcpBuildAuth(char *buf, size_t buflen) static ssize_t htcpBuildCountstr(char *buf, size_t buflen, const char *s) { - u_int16_t length; + uint16_t length; size_t len; int off = 0; @@ -334,7 +334,7 @@ htcpBuildCountstr(char *buf, size_t buflen, const char *s) debugs(31, 3, "htcpBuildCountstr: TEXT = {" << (s ? s : "") << "}"); - length = htons((u_int16_t) len); + length = htons((uint16_t) len); xmemcpy(buf + off, &length, 2); @@ -509,7 +509,7 @@ htcpBuildData(char *buf, size_t buflen, htcpStuff * stuff) debugs(31, 3, "htcpBuildData: hdr.length = " << off); - hdr.length = (u_int16_t) off; + hdr.length = (uint16_t) off; hdr.opcode = stuff->op; @@ -576,7 +576,7 @@ htcpBuildPacket(char *buf, size_t buflen, htcpStuff * stuff) } off += s; - hdr.length = htons((u_int16_t) off); + hdr.length = htons((uint16_t) off); hdr.major = 0; if (old_squid_format) @@ -653,7 +653,7 @@ htcpUnpackSpecifier(char *buf, int sz) HttpRequestMethod method; /* Find length of METHOD */ - u_int16_t l = ntohs(*(u_int16_t *) buf); + uint16_t l = ntohs(*(uint16_t *) buf); sz -= 2; buf += 2; @@ -670,7 +670,7 @@ htcpUnpackSpecifier(char *buf, int sz) debugs(31, 6, "htcpUnpackSpecifier: METHOD (" << l << "/" << sz << ") '" << s->method << "'"); /* Find length of URI */ - l = ntohs(*(u_int16_t *) buf); + l = ntohs(*(uint16_t *) buf); sz -= 2; if (l > sz) { @@ -690,7 +690,7 @@ htcpUnpackSpecifier(char *buf, int sz) debugs(31, 6, "htcpUnpackSpecifier: URI (" << l << "/" << sz << ") '" << s->uri << "'"); /* Find length of VERSION */ - l = ntohs(*(u_int16_t *) buf); + l = ntohs(*(uint16_t *) buf); sz -= 2; if (l > sz) { @@ -710,7 +710,7 @@ htcpUnpackSpecifier(char *buf, int sz) debugs(31, 6, "htcpUnpackSpecifier: VERSION (" << l << "/" << sz << ") '" << s->version << "'"); /* Find length of REQ-HDRS */ - l = ntohs(*(u_int16_t *) buf); + l = ntohs(*(uint16_t *) buf); sz -= 2; if (l > sz) { @@ -761,7 +761,7 @@ htcpUnpackDetail(char *buf, int sz) htcpDetail *d = static_cast(htcpDetailPool->alloc()); /* Find length of RESP-HDRS */ - u_int16_t l = ntohs(*(u_int16_t *) buf); + uint16_t l = ntohs(*(uint16_t *) buf); sz -= 2; buf += 2; @@ -779,7 +779,7 @@ htcpUnpackDetail(char *buf, int sz) sz -= l; /* Find length of ENTITY-HDRS */ - l = ntohs(*(u_int16_t *) buf); + l = ntohs(*(uint16_t *) buf); sz -= 2; @@ -802,7 +802,7 @@ htcpUnpackDetail(char *buf, int sz) sz -= l; /* Find length of CACHE-HDRS */ - l = ntohs(*(u_int16_t *) buf); + l = ntohs(*(uint16_t *) buf); sz -= 2; diff --git a/src/htcp.h b/src/htcp.h index 1e2e70ce4e..ba862f6cc7 100644 --- a/src/htcp.h +++ b/src/htcp.h @@ -44,7 +44,7 @@ public: HtcpReplyData(); int hit; HttpHeader hdr; - u_int32_t msg_id; + uint32_t msg_id; double version; struct cto_t { diff --git a/src/icmp/Icmp.cc b/src/icmp/Icmp.cc index fe0a032cf7..329c64ddb2 100644 --- a/src/icmp/Icmp.cc +++ b/src/icmp/Icmp.cc @@ -107,7 +107,7 @@ Icmp::ipHops(int ttl) } void -Icmp::Log(const Ip::Address &addr, const u_int8_t type, const char* pkt_str, const int rtt, const int hops) +Icmp::Log(const Ip::Address &addr, const uint8_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) << diff --git a/src/icmp/Icmp.h b/src/icmp/Icmp.h index 3484acd15a..1dcc80ea8b 100644 --- a/src/icmp/Icmp.h +++ b/src/icmp/Icmp.h @@ -137,7 +137,7 @@ protected: int ipHops(int ttl); /// Log the packet. - void Log(const Ip::Address &addr, const u_int8_t type, const char* pkt_str, const int rtt, const int hops); + void Log(const Ip::Address &addr, const uint8_t type, const char* pkt_str, const int rtt, const int hops); /* no use wasting memory */ int icmp_sock; diff --git a/src/icmp/Icmp4.h b/src/icmp/Icmp4.h index 4bf7b37534..e34d06a85e 100644 --- a/src/icmp/Icmp4.h +++ b/src/icmp/Icmp4.h @@ -104,30 +104,30 @@ /* IP Header */ typedef struct iphdr { -u_int8_t ip_vhl: +uint8_t ip_vhl: 4; /* Length of the header in dwords */ -u_int8_t version: +uint8_t version: 4; /* Version of IP */ - u_int8_t tos; /* Type of service */ - u_int16_t total_len; /* Length of the packet in dwords */ - u_int16_t ident; /* unique identifier */ - u_int16_t flags; /* Flags */ - u_int8_t ip_ttl; /* Time to live */ - u_int8_t proto; /* Protocol number (TCP, UDP etc) */ - u_int16_t checksum; /* IP checksum */ - u_int32_t source_ip; - u_int32_t dest_ip; + uint8_t tos; /* Type of service */ + uint16_t total_len; /* Length of the packet in dwords */ + uint16_t ident; /* unique identifier */ + uint16_t flags; /* Flags */ + uint8_t ip_ttl; /* Time to live */ + uint8_t proto; /* Protocol number (TCP, UDP etc) */ + uint16_t checksum; /* IP checksum */ + uint32_t source_ip; + uint32_t dest_ip; } iphdr; /* ICMP header */ typedef struct icmphdr { - u_int8_t icmp_type; /* ICMP packet type */ - u_int8_t icmp_code; /* Type sub code */ - u_int16_t icmp_cksum; - u_int16_t icmp_id; - u_int16_t icmp_seq; - u_int32_t timestamp; /* not part of ICMP, but we need it */ + uint8_t icmp_type; /* ICMP packet type */ + uint8_t icmp_code; /* Type sub code */ + uint16_t icmp_cksum; + uint16_t icmp_id; + uint16_t icmp_seq; + uint32_t timestamp; /* not part of ICMP, but we need it */ } icmphdr; #endif /* _SQUID_MSWIN_ */ diff --git a/src/icp_v2.cc b/src/icp_v2.cc index 2afd304e89..b8c4c8f982 100644 --- a/src/icp_v2.cc +++ b/src/icp_v2.cc @@ -135,7 +135,7 @@ public: int rtt; int src_rtt; - u_int32_t flags; + uint32_t flags; }; ICP2State::~ICP2State() @@ -239,7 +239,7 @@ _icp_common_t::createMessage( buf_len = sizeof(icp_common_t) + strlen(url) + 1; if (opcode == ICP_QUERY) - buf_len += sizeof(u_int32_t); + buf_len += sizeof(uint32_t); buf = (char *) xcalloc(buf_len, 1); @@ -249,7 +249,7 @@ _icp_common_t::createMessage( headerp->version = ICP_VERSION_CURRENT; - headerp->length = (u_int16_t) htons(buf_len); + headerp->length = (uint16_t) htons(buf_len); headerp->reqnum = htonl(reqnum); @@ -262,7 +262,7 @@ _icp_common_t::createMessage( urloffset = buf + sizeof(icp_common_t); if (opcode == ICP_QUERY) - urloffset += sizeof(u_int32_t); + urloffset += sizeof(uint32_t); xmemcpy(urloffset, url, strlen(url)); @@ -449,9 +449,9 @@ doV2Query(int fd, Ip::Address &from, char *buf, icp_common_t header) { int rtt = 0; int src_rtt = 0; - u_int32_t flags = 0; + uint32_t flags = 0; /* We have a valid packet */ - char *url = buf + sizeof(icp_common_t) + sizeof(u_int32_t); + char *url = buf + sizeof(icp_common_t) + sizeof(uint32_t); HttpRequest *icp_request = icpGetRequest(url, header.reqnum, fd, from); if (!icp_request) @@ -649,7 +649,7 @@ icpHandleUdp(int sock, void *data) void icpConnectionsOpen(void) { - u_int16_t port; + uint16_t port; Ip::Address addr; struct addrinfo *xai = NULL; diff --git a/src/icp_v3.cc b/src/icp_v3.cc index 109e0feabc..510dbcb005 100644 --- a/src/icp_v3.cc +++ b/src/icp_v3.cc @@ -59,7 +59,7 @@ static void doV3Query(int fd, Ip::Address &from, char *buf, icp_common_t header) { /* We have a valid packet */ - char *url = buf + sizeof(icp_common_t) + sizeof(u_int32_t); + char *url = buf + sizeof(icp_common_t) + sizeof(uint32_t); HttpRequest *icp_request = icpGetRequest (url, header.reqnum, fd, from); if (!icp_request) diff --git a/src/wccp2.cc b/src/wccp2.cc index d4769339d0..f9af664b16 100644 --- a/src/wccp2.cc +++ b/src/wccp2.cc @@ -577,7 +577,7 @@ wccp2_get_service_by_id(int service, int service_id) { static char wccp2_update_md5_security(char *password, char *ptr, char *packet, int len) { - u_int8_t md5_digest[16]; + uint8_t md5_digest[16]; char pwd[WCCP2_PASSWORD_LEN]; SquidMD5_CTX M; @@ -631,7 +631,7 @@ wccp2_check_security(struct wccp2_service_list_t *srv, char *security, char *pac { struct wccp2_security_md5_t *ws = (struct wccp2_security_md5_t *) security; - u_int8_t md5_digest[16], md5_challenge[16]; + uint8_t md5_digest[16], md5_challenge[16]; char pwd[WCCP2_PASSWORD_LEN]; SquidMD5_CTX M; -- 2.47.3