*/
#ifndef lint
-static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-egp.c,v 1.33 2002-11-09 17:19:25 itojun Exp $ (LBL)";
+static const char rcsid[] _U_ =
+ "@(#) $Header: /tcpdump/master/tcpdump/print-egp.c,v 1.38 2006-02-11 22:13:24 hannes Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#include "interface.h"
#include "addrtoname.h"
+#include "extract.h"
#include "ip.h"
} egp_pands;
#define egp_poll egp_pands.egpu_poll
#define egp_sourcenet egp_pands.egpu_sourcenet
-} __attribute__((packed));
+};
const char *egp_acquire_codes[] = {
"request",
}
void
-egp_print(register const u_int8_t *bp)
+egp_print(register const u_int8_t *bp, register u_int length)
{
register const struct egp_packet *egp;
register int status;
register int type;
egp = (struct egp_packet *)bp;
- if (!TTEST(*egp)) {
+ if (!TTEST2(*egp, length)) {
printf("[|egp]");
return;
}
- (void)printf("egp: ");
+
+ if (!vflag) {
+ printf("EGPv%u, AS %u, seq %u, length %u",
+ egp->egp_version,
+ EXTRACT_16BITS(&egp->egp_as),
+ EXTRACT_16BITS(&egp->egp_sequence),
+ length);
+ return;
+ } else
+ printf("EGPv%u, length %u",
+ egp->egp_version,
+ length);
if (egp->egp_version != EGP_VERSION) {
printf("[version %d]", egp->egp_version);
return;
}
- printf("as:%d seq:%d", ntohs(egp->egp_as), ntohs(egp->egp_sequence));
type = egp->egp_type;
code = egp->egp_code;
break;
}
printf(" hello:%d poll:%d",
- ntohs(egp->egp_hello),
- ntohs(egp->egp_poll));
+ EXTRACT_16BITS(&egp->egp_hello),
+ EXTRACT_16BITS(&egp->egp_poll));
break;
case EGPC_REFUSE:
else
printf(" [status %d]", status);
- if (ntohs(egp->egp_reason) <= EGPR_UVERSION)
- printf(" %s", egp_reasons[ntohs(egp->egp_reason)]);
+ if (EXTRACT_16BITS(&egp->egp_reason) <= EGPR_UVERSION)
+ printf(" %s", egp_reasons[EXTRACT_16BITS(&egp->egp_reason)]);
else
- printf(" [reason %d]", ntohs(egp->egp_reason));
+ printf(" [reason %d]", EXTRACT_16BITS(&egp->egp_reason));
break;
default: