예제 #1
0
파일: print-wb.c 프로젝트: rwdxll/tcpdump
/*
 * Print whiteboard multicast packets.
 */
void
wb_print(netdissect_options *ndo,
         register const void *hdr, register u_int len)
{
	register const struct pkt_hdr *ph;

	ph = (const struct pkt_hdr *)hdr;
	if (len < sizeof(*ph) || (u_char *)(ph + 1) > ndo->ndo_snapend) {
		ND_PRINT((ndo, "%s", tstr));
		return;
	}
	len -= sizeof(*ph);

	if (ph->ph_flags)
		ND_PRINT((ndo, "*"));
	switch (ph->ph_type) {

	case PT_KILL:
		ND_PRINT((ndo, " wb-kill"));
		return;

	case PT_ID:
		if (wb_id(ndo, (struct pkt_id *)(ph + 1), len) >= 0)
			return;
		break;

	case PT_RREQ:
		if (wb_rreq(ndo, (struct pkt_rreq *)(ph + 1), len) >= 0)
			return;
		break;

	case PT_RREP:
		if (wb_rrep(ndo, (struct pkt_rrep *)(ph + 1), len) >= 0)
			return;
		break;

	case PT_DRAWOP:
		if (wb_drawop(ndo, (struct pkt_dop *)(ph + 1), len) >= 0)
			return;
		break;

	case PT_PREQ:
		if (wb_preq(ndo, (struct pkt_preq *)(ph + 1), len) >= 0)
			return;
		break;

	case PT_PREP:
		if (wb_prep(ndo, (struct pkt_prep *)(ph + 1), len) >= 0)
			return;
		break;

	default:
		ND_PRINT((ndo, " wb-%d!", ph->ph_type));
		return;
	}
}
예제 #2
0
/*
 * Print whiteboard multicast packets.
 */
void
wb_print(register const void *hdr, register u_int len)
{
	register const struct pkt_hdr *ph;

	ph = (const struct pkt_hdr *)hdr;
	if (len < sizeof(*ph) || (u_char *)(ph + 1) > snapend) {
		printf("[|wb]");
		return;
	}
	len -= sizeof(*ph);

	if (ph->ph_flags)
		printf("*");
	switch (ph->ph_type) {

	case PT_KILL:
		printf(" wb-kill");
		return;

	case PT_ID:
		if (wb_id((struct pkt_id *)(ph + 1), len) >= 0)
			return;
		break;

	case PT_RREQ:
		if (wb_rreq((struct pkt_rreq *)(ph + 1), len) >= 0)
			return;
		break;

	case PT_RREP:
		if (wb_rrep((struct pkt_rrep *)(ph + 1), len) >= 0)
			return;
		break;

	case PT_DRAWOP:
		if (wb_drawop((struct pkt_dop *)(ph + 1), len) >= 0)
			return;
		break;

	case PT_PREQ:
		if (wb_preq((struct pkt_preq *)(ph + 1), len) >= 0)
			return;
		break;

	case PT_PREP:
		if (wb_prep((struct pkt_prep *)(ph + 1), len) >= 0)
			return;
		break;

	default:
		printf(" wb-%d!", ph->ph_type);
		return;
	}
}