/* \summary: AppleTalk printer */
#ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
#endif
-#include <netdissect-stdinc.h>
+#include "netdissect-stdinc.h"
#include <stdio.h>
#include <string.h>
static const struct atNBPtuple *nbp_name_print(netdissect_options *, const struct atNBPtuple *,
const u_char *);
static const char *ataddr_string(netdissect_options *, u_short, u_char);
-static void ddp_print(netdissect_options *, const u_char *, u_int, int, u_short, u_char, u_char);
-static const char *ddpskt_string(netdissect_options *, int);
+static void ddp_print(netdissect_options *, const u_char *, u_int, u_int, u_short, u_char, u_char);
+static const char *ddpskt_string(netdissect_options *, u_int);
/*
* Print LLAP packets received on a physical LocalTalk interface.
*/
static void
ddp_print(netdissect_options *ndo,
- const u_char *bp, u_int length, int t,
+ const u_char *bp, u_int length, u_int t,
u_short snet, u_char snode, u_char skt)
{
break;
default:
- ND_PRINT(" at-%s %d", tok2str(type2str, NULL, t), length);
+ ND_PRINT(" at-%s %u", tok2str(type2str, NULL, t), length);
break;
}
}
break;
case atpRspCode:
- ND_PRINT(" atp-resp%s%d:%u (%u)",
+ ND_PRINT(" atp-resp%s%u:%u (%u)",
control & atpEOM? "*" : " ",
EXTRACT_BE_U_2(ap->transID), EXTRACT_U_1(ap->bitmap), length);
switch (control & (atpXO|atpSTS)) {
break;
default:
- ND_PRINT(" atp-0x%x %d (%u)", control,
+ ND_PRINT(" atp-0x%x %u (%u)", control,
EXTRACT_BE_U_2(ap->transID), length);
break;
}
atp_bitmap_print(netdissect_options *ndo,
u_char bm)
{
- int i;
+ u_int i;
/*
* The '& 0xff' below is needed for compilers that want to sign
char c = '<';
for (i = 0; bm; ++i) {
if (bm & 1) {
- ND_PRINT("%c%d", c, i);
+ ND_PRINT("%c%u", c, i);
c = ',';
}
bm >>= 1;
for (i = 0; bm; ++i)
bm >>= 1;
if (i > 1)
- ND_PRINT("<0-%d>", i - 1);
+ ND_PRINT("<0-%u>", i - 1);
else
ND_PRINT("<0>");
}
const struct atNBPtuple *tp =
(const struct atNBPtuple *)((const u_char *)np + nbpHeaderSize);
uint8_t control;
- int i;
+ u_int i;
const u_char *ep;
if (length < nbpHeaderSize) {
if (EXTRACT_BE_U_2(tp->net) != snet ||
EXTRACT_U_1(tp->node) != snode ||
EXTRACT_U_1(tp->skt) != skt)
- ND_PRINT(" [addr=%s.%d]",
+ ND_PRINT(" [addr=%s.%u]",
ataddr_string(ndo, EXTRACT_BE_U_2(tp->net),
EXTRACT_U_1(tp->node)),
- EXTRACT_U_1(tp->skt));
+ EXTRACT_U_1(tp->skt));
break;
case nbpLkUpReply:
ND_PRINT(" nbp-reply %u:", EXTRACT_U_1(np->id));
/* print each of the tuples in the reply */
- for (i = control & 0xf; --i >= 0 && tp; )
+ for (i = control & 0xf; i != 0 && tp; i--)
tp = nbp_tuple_print(ndo, tp, ep, snet, snode, skt);
break;
#define HASHNAMESIZE 4096
struct hnamemem {
- int addr;
+ u_int addr;
char *name;
struct hnamemem *nxt;
};
u_short atnet, u_char athost)
{
struct hnamemem *tp, *tp2;
- int i = (atnet << 8) | athost;
+ u_int i = (atnet << 8) | athost;
char nambuf[256+1];
static int first = 1;
FILE *fp;
if (first && (first = 0, !ndo->ndo_nflag)
&& (fp = fopen("/etc/atalk.names", "r"))) {
char line[256];
- int i1, i2;
+ u_int i1, i2;
while (fgets(line, sizeof(line), fp)) {
if (line[0] == '\n' || line[0] == 0 || line[0] == '#')
continue;
- if (sscanf(line, "%d.%d %256s", &i1, &i2, nambuf) == 3)
+ if (sscanf(line, "%u.%u %256s", &i1, &i2, nambuf) == 3)
/* got a hostname. */
i2 |= (i1 << 8);
- else if (sscanf(line, "%d %256s", &i1, nambuf) == 2)
+ else if (sscanf(line, "%u %256s", &i1, nambuf) == 2)
/* got a net name */
i2 = (i1 << 8) | 255;
else
if (tp2->addr == i) {
tp->addr = (atnet << 8) | athost;
tp->nxt = newhnamemem(ndo);
- (void)snprintf(nambuf, sizeof(nambuf), "%s.%d",
+ (void)snprintf(nambuf, sizeof(nambuf), "%s.%u",
tp2->name, athost);
tp->name = strdup(nambuf);
if (tp->name == NULL)
tp->addr = (atnet << 8) | athost;
tp->nxt = newhnamemem(ndo);
if (athost != 255)
- (void)snprintf(nambuf, sizeof(nambuf), "%d.%d", atnet, athost);
+ (void)snprintf(nambuf, sizeof(nambuf), "%u.%u", atnet, athost);
else
- (void)snprintf(nambuf, sizeof(nambuf), "%d", atnet);
+ (void)snprintf(nambuf, sizeof(nambuf), "%u", atnet);
tp->name = strdup(nambuf);
if (tp->name == NULL)
(*ndo->ndo_error)(ndo, "ataddr_string: strdup(nambuf)");
static const char *
ddpskt_string(netdissect_options *ndo,
- int skt)
+ u_int skt)
{
static char buf[8];
if (ndo->ndo_nflag) {
- (void)snprintf(buf, sizeof(buf), "%d", skt);
+ (void)snprintf(buf, sizeof(buf), "%u", skt);
return (buf);
}
- return (tok2str(skt2str, "%d", skt));
+ return (tok2str(skt2str, "%u", skt));
}