#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-rx.c,v 1.12 2000-07-10 04:38:25 assar Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-rx.c,v 1.13 2000-07-22 17:32:32 assar Exp $";
#endif
#ifdef HAVE_CONFIG_H
* These extrememly grody macros handle the printing of various AFS stuff.
*/
-#define TRUNC(n) if (snapend - bp + 1 <= n) goto trunc;
#define FIDOUT() { unsigned long n1, n2, n3; \
- TRUNC(sizeof(int32_t) * 3); \
+ TCHECK2(bp[0], sizeof(int32_t) * 3); \
n1 = EXTRACT_32BITS(bp); \
bp += sizeof(int32_t); \
n2 = EXTRACT_32BITS(bp); \
}
#define STROUT(MAX) { int i; \
- TRUNC(sizeof(int32_t)); \
+ TCHECK2(bp[0], sizeof(int32_t)); \
i = (int) EXTRACT_32BITS(bp); \
bp += sizeof(int32_t); \
- TRUNC(i); \
+ TCHECK2(bp[0], i); \
strncpy(s, (char *) bp, min(MAX, i)); \
s[i] = '\0'; \
printf(" \"%s\"", s); \
}
#define INTOUT() { int i; \
- TRUNC(sizeof(int32_t)); \
+ TCHECK2(bp[0], sizeof(int32_t)); \
i = (int) EXTRACT_32BITS(bp); \
bp += sizeof(int32_t); \
printf(" %d", i); \
}
#define UINTOUT() { unsigned long i; \
- TRUNC(sizeof(int32_t)); \
+ TCHECK2(bp[0], sizeof(int32_t)); \
i = EXTRACT_32BITS(bp); \
bp += sizeof(int32_t); \
printf(" %lu", i); \
}
#define DATEOUT() { time_t t; struct tm *tm; char str[256]; \
- TRUNC(sizeof(int32_t)); \
+ TCHECK2(bp[0], sizeof(int32_t)); \
t = (time_t) EXTRACT_32BITS(bp); \
bp += sizeof(int32_t); \
tm = localtime(&t); \
}
#define STOREATTROUT() { unsigned long mask, i; \
- TRUNC((sizeof(int32_t)*6)); \
+ TCHECK2(bp[0], (sizeof(int32_t)*6)); \
mask = EXTRACT_32BITS(bp); bp += sizeof(int32_t); \
if (mask) printf (" StoreStatus"); \
if (mask & 1) { printf(" date"); DATEOUT(); } \
}
#define UBIK_VERSIONOUT() {int32_t epoch; int32_t counter; \
- TRUNC(sizeof(int32_t) * 2); \
+ TCHECK2(bp[0], sizeof(int32_t) * 2); \
epoch = EXTRACT_32BITS(bp); \
bp += sizeof(int32_t); \
counter = EXTRACT_32BITS(bp); \
}
#define AFSUUIDOUT() {u_int32_t temp; int i; \
- TRUNC(11*sizeof(u_int32_t)); \
+ TCHECK2(bp[0], 11*sizeof(u_int32_t)); \
temp = EXTRACT_32BITS(bp); \
bp += sizeof(u_int32_t); \
printf(" %08x", temp); \
#define VECOUT(MAX) { char *sp; \
int k; \
- TRUNC(MAX * sizeof(int32_t)); \
+ TCHECK2(bp[0], MAX * sizeof(int32_t)); \
sp = s; \
for (k = 0; k < MAX; k++) { \
*sp++ = (char) EXTRACT_32BITS(bp); \
{
char a[AFSOPAQUEMAX];
FIDOUT();
- TRUNC(4);
+ TCHECK2(bp[0], 4);
i = EXTRACT_32BITS(bp);
bp += sizeof(int32_t);
- TRUNC(i);
+ TCHECK2(bp[0], i);
strncpy(a, (char *) bp, min(AFSOPAQUEMAX, i));
a[i] = '\0';
acl_print((u_char *) a, (u_char *) a + i);
case 155: /* Bulk stat */
{
unsigned long j;
- TRUNC(4);
+ TCHECK2(bp[0], 4);
j = EXTRACT_32BITS(bp);
bp += sizeof(int32_t);
case 131: /* Fetch ACL */
{
char a[AFSOPAQUEMAX];
- TRUNC(4);
+ TCHECK2(bp[0], 4);
i = EXTRACT_32BITS(bp);
bp += sizeof(int32_t);
- TRUNC(i);
+ TCHECK2(bp[0], i);
strncpy(a, (char *) bp, min(AFSOPAQUEMAX, i));
a[i] = '\0';
acl_print((u_char *) a, (u_char *) a + i);
/*
* Otherwise, just print out the return code
*/
- TRUNC(sizeof(int32_t));
+ TCHECK2(bp[0], sizeof(int32_t));
i = (int) EXTRACT_32BITS(bp);
bp += sizeof(int32_t);
case 204: /* Callback */
{
unsigned long j, t;
- TRUNC(4);
+ TCHECK2(bp[0], 4);
j = EXTRACT_32BITS(bp);
bp += sizeof(int32_t);
INTOUT();
printf(" expires");
DATEOUT();
- TRUNC(4);
+ TCHECK2(bp[0], 4);
t = EXTRACT_32BITS(bp);
bp += sizeof(int32_t);
tok2str(cb_types, "type %d", t);
case 504: /* Name to ID */
{
unsigned long j;
- TRUNC(4);
+ TCHECK2(bp[0], 4);
j = EXTRACT_32BITS(bp);
bp += sizeof(int32_t);
{
unsigned long j;
printf(" ids:");
- TRUNC(4);
+ TCHECK2(bp[0], 4);
i = EXTRACT_32BITS(bp);
bp += sizeof(int32_t);
for (j = 0; j < i; j++)
{
unsigned long j;
printf(" ids:");
- TRUNC(4);
+ TCHECK2(bp[0], 4);
i = EXTRACT_32BITS(bp);
bp += sizeof(int32_t);
for (j = 0; j < i; j++)
case 505: /* ID to name */
{
unsigned long j;
- TRUNC(4);
+ TCHECK2(bp[0], 4);
j = EXTRACT_32BITS(bp);
bp += sizeof(int32_t);
case 519: /* Get host CPS */
{
unsigned long j;
- TRUNC(4);
+ TCHECK2(bp[0], 4);
j = EXTRACT_32BITS(bp);
bp += sizeof(int32_t);
for (i = 0; i < j; i++) {
case 518: /* Get entry by ID N */
printf(" volid");
INTOUT();
- TRUNC(sizeof(int32_t));
+ TCHECK2(bp[0], sizeof(int32_t));
i = EXTRACT_32BITS(bp);
bp += sizeof(int32_t);
if (i <= 2)
case 520: /* Replace entry N */
printf(" volid");
INTOUT();
- TRUNC(sizeof(int32_t));
+ TCHECK2(bp[0], sizeof(int32_t));
i = EXTRACT_32BITS(bp);
bp += sizeof(int32_t);
if (i <= 2)
case 504: /* Get entry by name */
{ unsigned long nservers, j;
VECOUT(VLNAMEMAX);
- TRUNC(sizeof(int32_t));
+ TCHECK2(bp[0], sizeof(int32_t));
bp += sizeof(int32_t);
printf(" numservers");
- TRUNC(sizeof(int32_t));
+ TCHECK2(bp[0], sizeof(int32_t));
nservers = EXTRACT_32BITS(bp);
bp += sizeof(int32_t);
printf(" %lu", nservers);
printf(" servers");
for (i = 0; i < 8; i++) {
- TRUNC(sizeof(int32_t));
+ TCHECK2(bp[0], sizeof(int32_t));
if (i < nservers)
printf(" %s",
inet_ntoa(*((struct in_addr *) bp)));
}
printf(" partitions");
for (i = 0; i < 8; i++) {
- TRUNC(sizeof(int32_t));
+ TCHECK2(bp[0], sizeof(int32_t));
j = EXTRACT_32BITS(bp);
if (i < nservers && j <= 26)
printf(" %c", 'a' + (int)j);
printf(" %lu", j);
bp += sizeof(int32_t);
}
- TRUNC(8 * sizeof(int32_t));
+ TCHECK2(bp[0], 8 * sizeof(int32_t));
bp += 8 * sizeof(int32_t);
printf(" rwvol");
UINTOUT();
{ unsigned long nservers, j;
VECOUT(VLNAMEMAX);
printf(" numservers");
- TRUNC(sizeof(int32_t));
+ TCHECK2(bp[0], sizeof(int32_t));
nservers = EXTRACT_32BITS(bp);
bp += sizeof(int32_t);
printf(" %lu", nservers);
printf(" servers");
for (i = 0; i < 13; i++) {
- TRUNC(sizeof(int32_t));
+ TCHECK2(bp[0], sizeof(int32_t));
if (i < nservers)
printf(" %s",
inet_ntoa(*((struct in_addr *) bp)));
}
printf(" partitions");
for (i = 0; i < 13; i++) {
- TRUNC(sizeof(int32_t));
+ TCHECK2(bp[0], sizeof(int32_t));
j = EXTRACT_32BITS(bp);
if (i < nservers && j <= 26)
printf(" %c", 'a' + (int)j);
printf(" %lu", j);
bp += sizeof(int32_t);
}
- TRUNC(13 * sizeof(int32_t));
+ TCHECK2(bp[0], 13 * sizeof(int32_t));
bp += 13 * sizeof(int32_t);
printf(" rwvol");
UINTOUT();
{ unsigned long nservers, j;
VECOUT(VLNAMEMAX);
printf(" numservers");
- TRUNC(sizeof(int32_t));
+ TCHECK2(bp[0], sizeof(int32_t));
nservers = EXTRACT_32BITS(bp);
bp += sizeof(int32_t);
printf(" %lu", nservers);
printf(" afsuuid");
AFSUUIDOUT();
} else {
- TRUNC(44);
+ TCHECK2(bp[0], 44);
bp += 44;
}
}
- TRUNC(4 * 13);
+ TCHECK2(bp[0], 4 * 13);
bp += 4 * 13;
printf(" partitions");
for (i = 0; i < 13; i++) {
- TRUNC(sizeof(int32_t));
+ TCHECK2(bp[0], sizeof(int32_t));
j = EXTRACT_32BITS(bp);
if (i < nservers && j <= 26)
printf(" %c", 'a' + (int)j);
printf(" %lu", j);
bp += sizeof(int32_t);
}
- TRUNC(13 * sizeof(int32_t));
+ TCHECK2(bp[0], 13 * sizeof(int32_t));
bp += 13 * sizeof(int32_t);
printf(" rwvol");
UINTOUT();
INTOUT();
printf(" domain");
STROUT(KANAMEMAX);
- TRUNC(sizeof(int32_t));
+ TCHECK2(bp[0], sizeof(int32_t));
i = (int) EXTRACT_32BITS(bp);
bp += sizeof(int32_t);
- TRUNC(i);
+ TCHECK2(bp[0], i);
bp += i;
printf(" principal");
STROUT(KANAMEMAX);
switch (ubik_op) {
case 10000: /* Beacon */
- TRUNC(4);
+ TCHECK2(bp[0], 4);
temp = EXTRACT_32BITS(bp);
bp += sizeof(int32_t);
printf(" syncsite %s", temp ? "yes" : "no");
* rx_ackPacket structure.
*/
- TRUNC(sizeof(struct rx_ackPacket) - RX_MAXACKS);
+ TCHECK2(bp[0], sizeof(struct rx_ackPacket) - RX_MAXACKS);
rxa = (struct rx_ackPacket *) bp;
bp += (sizeof(struct rx_ackPacket) - RX_MAXACKS);
if (rxa->nAcks != 0) {
- TRUNC(rxa->nAcks);
+ TCHECK2(bp[0], rxa->nAcks);
/*
* Sigh, this is gross, but it seems to work to collapse