#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
#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
#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
#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 */
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,[
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,[
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,[
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)
\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
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";
* 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;
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;
* 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);
}
* 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));
}
#include "util.h"
/* util.c */
-u_int32_t get_ipaddr (char *);
+uint32_t get_ipaddr (char *);
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) {
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);
* 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"
# 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)
# 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) */
u_short port;
int family, i;
const char *addr;
- u_int32_t v4a;
+ uint32_t v4a;
int h_error;
char numserv[512];
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;
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;
/*
* 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';
/** 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 " : ""),
* 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 */
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 */
} 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);
/* ************************************************************************* */
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,
/** 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 */
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;
const char *domain_controller,
const char *challenge_nonce,
const int challenge_nonce_len,
- const u_int32_t flags);
+ const uint32_t flags);
/* ************************************************************************* */
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)
/** 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.
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);
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;
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;
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();
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;
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 */
/* RR == 1 --> RESPONSE */
struct _htcpAuthHeader {
- u_int16_t length;
+ uint16_t length;
time_t sig_time;
time_t sig_expire;
Countstr key_name;
int f1;
int response;
int reason;
- u_int32_t msg_id;
+ uint32_t msg_id;
htcpSpecifier S;
htcpDetail D;
};
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];
{
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)
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;
debugs(31, 3, "htcpBuildCountstr: TEXT = {" << (s ? s : "<NULL>") << "}");
- length = htons((u_int16_t) len);
+ length = htons((uint16_t) len);
xmemcpy(buf + off, &length, 2);
debugs(31, 3, "htcpBuildData: hdr.length = " << off);
- hdr.length = (u_int16_t) off;
+ hdr.length = (uint16_t) off;
hdr.opcode = stuff->op;
}
off += s;
- hdr.length = htons((u_int16_t) off);
+ hdr.length = htons((uint16_t) off);
hdr.major = 0;
if (old_squid_format)
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;
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) {
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) {
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) {
htcpDetail *d = static_cast<htcpDetail *>(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;
sz -= l;
/* Find length of ENTITY-HDRS */
- l = ntohs(*(u_int16_t *) buf);
+ l = ntohs(*(uint16_t *) buf);
sz -= 2;
sz -= l;
/* Find length of CACHE-HDRS */
- l = ntohs(*(u_int16_t *) buf);
+ l = ntohs(*(uint16_t *) buf);
sz -= 2;
HtcpReplyData();
int hit;
HttpHeader hdr;
- u_int32_t msg_id;
+ uint32_t msg_id;
double version;
struct cto_t {
}
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) <<
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;
/* 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_ */
int rtt;
int src_rtt;
- u_int32_t flags;
+ uint32_t flags;
};
ICP2State::~ICP2State()
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);
headerp->version = ICP_VERSION_CURRENT;
- headerp->length = (u_int16_t) htons(buf_len);
+ headerp->length = (uint16_t) htons(buf_len);
headerp->reqnum = htonl(reqnum);
urloffset = buf + sizeof(icp_common_t);
if (opcode == ICP_QUERY)
- urloffset += sizeof(u_int32_t);
+ urloffset += sizeof(uint32_t);
xmemcpy(urloffset, url, strlen(url));
{
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)
void
icpConnectionsOpen(void)
{
- u_int16_t port;
+ uint16_t port;
Ip::Address addr;
struct addrinfo *xai = NULL;
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)
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;
{
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;