print-pim.c revision 17680
11195Srgrimes/*
217639Swosch * Copyright (c) 1995, 1996
337Srgrimes *	The Regents of the University of California.  All rights reserved.
437Srgrimes *
5147Srgrimes * Redistribution and use in source and binary forms, with or without
6147Srgrimes * modification, are permitted provided that: (1) source code distributions
713997Sjkh * retain the above copyright notice and this paragraph in its entirety, (2)
83017Srgrimes * distributions including binary code include the above copyright notice and
914104Sjoerg * this paragraph in its entirety in the documentation or other materials
1014662Sphk * provided with the distribution, and (3) all advertising materials mentioning
1115027Sphk * features or use of this software display the following acknowledgement:
1215027Sphk * ``This product includes software developed by the University of California,
137487Srgrimes * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
145356Sache * the University nor the names of its contributors may be used to endorse
151734Sjkh * or promote products derived from this software without specific prior
1617639Swosch * written permission.
1717639Swosch * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
1837Srgrimes * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
1937Srgrimes * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
2037Srgrimes */
2137Srgrimes
221773Sjkh#ifndef lint
2314662Sphkstatic char rcsid[] =
24147Srgrimes    "@(#) $Header: print-pim.c,v 1.6 96/07/23 14:17:26 leres Exp $ (LBL)";
25491Srgrimes#endif
267273Srgrimes
276177Samurai#include <sys/param.h>
286177Samurai#include <sys/time.h>
2937Srgrimes#include <sys/socket.h>
3017639Swosch
31263Srgrimes#include <netinet/in.h>
322779Srgrimes#include <netinet/in_systm.h>
338857Srgrimes#include <netinet/ip.h>
34993Srgrimes#include <netinet/ip_var.h>
35263Srgrimes#include <netinet/udp.h>
3617104Spst#include <netinet/udp_var.h>
3717104Spst#include <netinet/tcp.h>
3817104Spst#include <netinet/tcpip.h>
3911635Sache
406744Sache#include <stdio.h>
416744Sache#include <stdlib.h>
426744Sache#include <unistd.h>
436744Sache
446744Sache#include "interface.h"
451767Sjkh#include "addrtoname.h"
4637Srgrimes
474487Sphkvoid
486717Sphkpim_print(register const u_char *bp, register u_int len)
495948Sjkh{
504487Sphk    register const u_char *ep;
511759Sjkh    register u_char type;
529970Sbde
539970Sbde    ep = (const u_char *)snapend;
549970Sbde    if (bp >= ep)
559970Sbde	return;
569970Sbde
571759Sjkh    type = bp[1];
589970Sbde
591759Sjkh    switch (type) {
6017639Swosch    case 0:
6117639Swosch	(void)printf(" Query");
6217639Swosch	break;
6317639Swosch
641759Sjkh    case 1:
659970Sbde	(void)printf(" Register");
661759Sjkh	break;
671759Sjkh
681731Sjkh    case 2:
699970Sbde	(void)printf(" Register-Stop");
7037Srgrimes	break;
719970Sbde
7237Srgrimes    case 3:
739970Sbde	(void)printf(" Join/Prune");
7437Srgrimes	break;
759970Sbde
7637Srgrimes    case 4:
7737Srgrimes	(void)printf(" RP-reachable");
7837Srgrimes	break;
7937Srgrimes
809970Sbde    case 5:
811731Sjkh	(void)printf(" Assert");
829970Sbde	break;
831731Sjkh
849970Sbde    case 6:
856177Samurai	(void)printf(" Graft");
869970Sbde	break;
8737Srgrimes
889970Sbde    case 7:
89147Srgrimes	(void)printf(" Graft-ACK");
909970Sbde	break;
91147Srgrimes
929970Sbde    case 8:
9337Srgrimes	(void)printf(" Mode");
949970Sbde	break;
95288Srgrimes
969970Sbde    default:
97147Srgrimes	(void)printf(" [type %d]", type);
9813378Sache	break;
9913378Sache    }
10017104Spst}
10117104Spst