summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorderaadt <deraadt@NetBSD.org>1994-10-15 07:56:51 +0000
committerderaadt <deraadt@NetBSD.org>1994-10-15 07:56:51 +0000
commit2343dc8f90d944be1fa3752fbdbdc6eff6adc94e (patch)
treef838cef9d2ba8cd90d44123bbf3f43c95bb92f05
parent63afb063a5ee22c8e01c500374b2877a29361e20 (diff)
u_int_{16,32}_t stuff
-rw-r--r--include/arpa/nameser.h42
-rw-r--r--include/resolv.h10
-rw-r--r--lib/libc/net/gethostnamadr.c22
-rw-r--r--lib/libc/net/res_comp.c12
-rw-r--r--lib/libc/net/res_debug.c38
-rw-r--r--lib/libc/net/res_init.c8
6 files changed, 66 insertions, 66 deletions
diff --git a/include/arpa/nameser.h b/include/arpa/nameser.h
index 3728de15b25..cdc2197f37c 100644
--- a/include/arpa/nameser.h
+++ b/include/arpa/nameser.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* from: @(#)nameser.h 5.25 (Berkeley) 4/3/91
- * $Id: nameser.h,v 1.5 1994/04/07 06:59:03 deraadt Exp $
+ * $Id: nameser.h,v 1.6 1994/10/15 07:56:55 deraadt Exp $
*/
#ifndef _NAMESER_H_
@@ -189,16 +189,16 @@ typedef struct {
* Structure for passing resource records around.
*/
struct rrec {
- short r_zone; /* zone number */
- short r_class; /* class number */
- short r_type; /* type number */
- u_long r_ttl; /* time to live */
- int r_size; /* size of data area */
- char *r_data; /* pointer to data */
+ int16_t r_zone; /* zone number */
+ int16_t r_class; /* class number */
+ int16_t r_type; /* type number */
+ u_int32_t r_ttl; /* time to live */
+ int r_size; /* size of data area */
+ char *r_data; /* pointer to data */
};
-extern u_short _getshort();
-extern u_long _getlong();
+extern u_int16_t _getshort();
+extern u_int32_t _getlong();
/*
* Inline versions of get/put short/long.
@@ -208,26 +208,26 @@ extern u_long _getlong();
*/
#define GETSHORT(s, cp) { \
register u_char *t_cp = (u_char *)(cp); \
- (s) = ((u_short)t_cp[0] << 8) \
- | ((u_short)t_cp[1]) ;\
- (cp) += 2; \
+ (s) = ((u_int16_t)t_cp[0] << 8) \
+ | ((u_int16_t)t_cp[1]) ;\
+ (cp) += sizeof(u_int16_t); \
}
#define GETLONG(l, cp) { \
register u_char *t_cp = (u_char *)(cp); \
- (l) = ((u_long)t_cp[0] << 24) \
- | ((u_long)t_cp[1] << 16) \
- | ((u_long)t_cp[2] << 8) \
- | ((u_long)t_cp[3]) ;\
- (cp) += 4; \
+ (l) = ((u_int32_t)t_cp[0] << 24) \
+ | ((u_int32_t)t_cp[1] << 16) \
+ | ((u_int32_t)t_cp[2] << 8) \
+ | ((u_int32_t)t_cp[3]) ;\
+ (cp) += sizeof(u_int32_t); \
}
#define PUTSHORT(s, cp) { \
- register u_short t_s = (u_short)(s); \
+ register u_int16_t t_s = (u_int16_t)(s); \
register u_char *t_cp = (u_char *)(cp); \
*t_cp++ = t_s >> 8; \
*t_cp = t_s; \
- (cp) += 2; \
+ (cp) += sizeof(u_int16_t); \
}
/*
@@ -235,13 +235,13 @@ extern u_long _getlong();
* were depending on this "feature", you will lose.
*/
#define PUTLONG(l, cp) { \
- register u_long t_l = (u_long)(l); \
+ register u_int32_t t_l = (u_int32_t)(l); \
register u_char *t_cp = (u_char *)(cp); \
*t_cp++ = t_l >> 24; \
*t_cp++ = t_l >> 16; \
*t_cp++ = t_l >> 8; \
*t_cp = t_l; \
- (cp) += 4; \
+ (cp) += sizeof(u_int32_t); \
}
#endif /* !_NAMESER_H_ */
diff --git a/include/resolv.h b/include/resolv.h
index 37eef7c8080..e55653a74f1 100644
--- a/include/resolv.h
+++ b/include/resolv.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* from: @(#)resolv.h 5.15 (Berkeley) 4/3/91
- * $Id: resolv.h,v 1.5 1994/06/13 01:16:13 jtc Exp $
+ * $Id: resolv.h,v 1.6 1994/10/15 07:56:51 deraadt Exp $
*/
#ifndef _RESOLV_H_
@@ -86,7 +86,7 @@ struct __res_state {
char unused[3];
struct {
struct in_addr addr;
- u_long mask;
+ u_int32_t mask;
} sort_list[MAXRESOLVSORT];
char lookups[MAXDNSLUS];
};
@@ -145,10 +145,10 @@ __BEGIN_DECLS
int __dn_skipname __P((const u_char *, const u_char *));
void __fp_query __P((char *, FILE *));
char *__hostalias __P((const char *));
-void __putlong __P((u_long, u_char *));
-void __putshort __P((u_short, u_char *));
+void __putlong __P((u_int32_t, u_char *));
+void __putshort __P((u_int16_t, u_char *));
char *__p_class __P((int));
-char *__p_time __P((u_long));
+char *__p_time __P((u_int32_t));
char *__p_type __P((int));
int dn_comp __P((const u_char *, u_char *, int, u_char **, u_char **));
diff --git a/lib/libc/net/gethostnamadr.c b/lib/libc/net/gethostnamadr.c
index 5dfeaf24115..198bf9d52c9 100644
--- a/lib/libc/net/gethostnamadr.c
+++ b/lib/libc/net/gethostnamadr.c
@@ -33,7 +33,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)gethostnamadr.c 6.45 (Berkeley) 2/24/91";*/
-static char *rcsid = "$Id: gethostnamadr.c,v 1.7 1994/04/14 07:47:37 deraadt Exp $";
+static char *rcsid = "$Id: gethostnamadr.c,v 1.8 1994/10/15 07:58:54 deraadt Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
@@ -76,13 +76,13 @@ static int stayopen = 0;
#endif
typedef union {
- HEADER hdr;
- u_char buf[MAXPACKET];
+ HEADER hdr;
+ u_char buf[MAXPACKET];
} querybuf;
typedef union {
- long al;
- char ac;
+ int32_t al;
+ char ac;
} align;
static int qcomp __P((struct in_addr **, struct in_addr **));
@@ -152,11 +152,11 @@ getanswer(answer, anslen, iquery)
break;
cp += n;
type = _getshort(cp);
- cp += sizeof(u_short);
+ cp += sizeof(u_int16_t);
class = _getshort(cp);
- cp += sizeof(u_short) + sizeof(u_long);
+ cp += sizeof(u_int16_t) + sizeof(u_int32_t);
n = _getshort(cp);
- cp += sizeof(u_short);
+ cp += sizeof(u_int16_t);
if (type == T_CNAME) {
cp += n;
if (ap >= &host_aliases[MAXALIASES-1])
@@ -266,7 +266,7 @@ gethostbyname(name)
host.h_aliases = host_aliases;
host_aliases[0] = NULL;
host.h_addrtype = AF_INET;
- host.h_length = sizeof(u_long);
+ host.h_length = sizeof(u_int32_t);
h_addr_ptrs[0] = (char *)&host_addr;
h_addr_ptrs[1] = NULL;
host.h_addr_list = h_addr_ptrs;
@@ -417,7 +417,7 @@ again:
h_addr_ptrs[1] = NULL;
host_addr.s_addr = inet_addr(p);
host.h_addr_list = h_addr_ptrs;
- host.h_length = sizeof (u_long);
+ host.h_length = sizeof(u_int32_t);
host.h_addrtype = AF_INET;
while (*cp == ' ' || *cp == '\t')
cp++;
@@ -511,7 +511,7 @@ _yphostent(line)
host.h_name = NULL;
host.h_addr_list = h_addr_ptrs;
- host.h_length = sizeof (u_long);
+ host.h_length = sizeof(u_int32_t);
host.h_addrtype = AF_INET;
hap = h_addr_ptrs;
buf = host_addrs;
diff --git a/lib/libc/net/res_comp.c b/lib/libc/net/res_comp.c
index 1526f148895..7b662607451 100644
--- a/lib/libc/net/res_comp.c
+++ b/lib/libc/net/res_comp.c
@@ -33,7 +33,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)res_comp.c 6.22 (Berkeley) 3/19/91";*/
-static char *rcsid = "$Id: res_comp.c,v 1.4 1994/04/07 07:00:16 deraadt Exp $";
+static char *rcsid = "$Id: res_comp.c,v 1.5 1994/10/15 07:58:56 deraadt Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
@@ -307,11 +307,11 @@ _getshort(msgp)
return (u);
}
-u_long
+u_int32_t
_getlong(msgp)
u_char *msgp;
{
- register u_long u;
+ register u_int32_t u;
GETLONG(u, msgp);
return (u);
@@ -319,10 +319,10 @@ _getlong(msgp)
void
#ifdef __STDC__
-__putshort(register u_short s, register u_char *msgp)
+__putshort(register u_int16_t s, register u_char *msgp)
#else
__putshort(s, msgp)
- register u_short s;
+ register u_int16_t s;
register u_char *msgp;
#endif
{
@@ -331,7 +331,7 @@ __putshort(s, msgp)
void
__putlong(l, msgp)
- register u_long l;
+ register u_int32_t l;
register u_char *msgp;
{
PUTLONG(l, msgp);
diff --git a/lib/libc/net/res_debug.c b/lib/libc/net/res_debug.c
index 5da6216aeb3..418c0d20929 100644
--- a/lib/libc/net/res_debug.c
+++ b/lib/libc/net/res_debug.c
@@ -51,7 +51,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)res_debug.c 8.1 (Berkeley) 6/4/93";
-static char rcsid[] = "$Id: res_debug.c,v 1.5 1994/04/07 07:00:18 deraadt Exp $";
+static char rcsid[] = "$Id: res_debug.c,v 1.6 1994/10/15 07:58:59 deraadt Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
@@ -303,11 +303,11 @@ __fp_query(msg,file)
if ((!_res.pfcode) || (_res.pfcode & RES_PRF_QUES))
fprintf(file, ", type = %s",
__p_type(_getshort(cp)));
- cp += sizeof(u_short);
+ cp += sizeof(u_int16_t);
if ((!_res.pfcode) || (_res.pfcode & RES_PRF_QUES))
fprintf(file, ", class = %s\n",
__p_class(_getshort(cp)));
- cp += sizeof(u_short);
+ cp += sizeof(u_int16_t);
putc('\n', file);
}
}
@@ -386,19 +386,19 @@ p_rr(cp, msg, file)
int type, class, dlen, n, c;
struct in_addr inaddr;
char *cp1, *cp2;
- u_long tmpttl, t;
+ u_int32_t tmpttl, t;
int lcnt;
if ((cp = p_fqname(cp, msg, file)) == NULL)
return (NULL); /* compression error */
type = _getshort(cp);
- cp += sizeof(u_short);
+ cp += sizeof(u_int16_t);
class = _getshort(cp);
- cp += sizeof(u_short);
+ cp += sizeof(u_int16_t);
tmpttl = _getlong(cp);
- cp += sizeof(u_long);
+ cp += sizeof(u_int32_t);
dlen = _getshort(cp);
- cp += sizeof(u_short);
+ cp += sizeof(u_int16_t);
cp1 = cp;
if ((!_res.pfcode) || (_res.pfcode & RES_PRF_TTLID))
fprintf(file, "\t%lu", tmpttl);
@@ -427,7 +427,7 @@ p_rr(cp, msg, file)
protocol = *(u_char*)cp;
cp += sizeof(u_char);
port = _getshort(cp);
- cp += sizeof(u_short);
+ cp += sizeof(u_int16_t);
fprintf(file, "\t%s\t; proto %d, port %d",
address, protocol, port);
}
@@ -463,22 +463,22 @@ p_rr(cp, msg, file)
putc(' ', file);
cp = p_fqname(cp, msg, file); /* mail addr */
fputs(" (\n", file);
- t = _getlong(cp); cp += sizeof(u_long);
+ t = _getlong(cp); cp += sizeof(u_int32_t);
fprintf(file,"\t\t\t%lu\t; serial\n", t);
- t = _getlong(cp); cp += sizeof(u_long);
+ t = _getlong(cp); cp += sizeof(u_int32_t);
fprintf(file,"\t\t\t%lu\t; refresh (%s)\n", t, __p_time(t));
- t = _getlong(cp); cp += sizeof(u_long);
+ t = _getlong(cp); cp += sizeof(u_int32_t);
fprintf(file,"\t\t\t%lu\t; retry (%s)\n", t, __p_time(t));
- t = _getlong(cp); cp += sizeof(u_long);
+ t = _getlong(cp); cp += sizeof(u_int32_t);
fprintf(file,"\t\t\t%lu\t; expire (%s)\n", t, __p_time(t));
- t = _getlong(cp); cp += sizeof(u_long);
+ t = _getlong(cp); cp += sizeof(u_int32_t);
fprintf(file,"\t\t\t%lu )\t; minimum (%s)", t, __p_time(t));
break;
case T_MX:
case T_AFSDB:
fprintf(file,"\t%d ", _getshort(cp));
- cp += sizeof(u_short);
+ cp += sizeof(u_int16_t);
cp = p_fqname(cp, msg, file);
break;
@@ -516,15 +516,15 @@ p_rr(cp, msg, file)
case T_GID:
if (dlen == 4) {
fprintf(file,"\t%u", _getlong(cp));
- cp += sizeof(long);
+ cp += sizeof(u_int32_t);
}
break;
case T_WKS:
- if (dlen < sizeof(u_long) + 1)
+ if (dlen < sizeof(u_int32_t) + 1)
break;
bcopy(cp, (char *)&inaddr, sizeof(inaddr));
- cp += sizeof(u_long);
+ cp += sizeof(u_int32_t);
fprintf(file, "\t%s %s ( ",
inet_ntoa(inaddr),
deproto((int) *cp));
@@ -698,7 +698,7 @@ p_option(option)
*/
char *
__p_time(value)
- u_long value;
+ u_int32_t value;
{
int secs, mins, hours, days;
register char *p;
diff --git a/lib/libc/net/res_init.c b/lib/libc/net/res_init.c
index 4a3ed2bb76a..0b45f00a553 100644
--- a/lib/libc/net/res_init.c
+++ b/lib/libc/net/res_init.c
@@ -33,7 +33,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)res_init.c 6.15 (Berkeley) 2/24/91";*/
-static char *rcsid = "$Id: res_init.c,v 1.5 1994/04/07 07:00:19 deraadt Exp $";
+static char *rcsid = "$Id: res_init.c,v 1.6 1994/10/15 07:59:01 deraadt Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
@@ -48,7 +48,7 @@ static char *rcsid = "$Id: res_init.c,v 1.5 1994/04/07 07:00:19 deraadt Exp $";
#include <string.h>
static void res_setoptions __P((char *, char *));
-static u_long net_mask __P((struct in_addr));
+static u_int32_t net_mask __P((struct in_addr));
/*
* Resolver state default settings
@@ -331,11 +331,11 @@ res_setoptions(options, source)
}
}
-static u_long
+static u_int32_t
net_mask(in) /* XXX - should really use system's version of this */
struct in_addr in;
{
- register u_long i = ntohl(in.s_addr);
+ register u_int32_t i = ntohl(in.s_addr);
if (IN_CLASSA(i))
return (htonl(IN_CLASSA_NET));