1*2393Syz155240 /* 2*2393Syz155240 * Copyright (C) 1993-2005 by Darren Reed. 3*2393Syz155240 * 4*2393Syz155240 * See the IPFILTER.LICENCE file for details on licencing. 5*2393Syz155240 */ 6*2393Syz155240 7*2393Syz155240 #include "ipf.h" 8*2393Syz155240 9*2393Syz155240 10*2393Syz155240 #if !defined(lint) 11*2393Syz155240 static const char rcsid[] = "@(#)$Id: printproto.c,v 1.1.2.1 2005/06/12 07:21:53 darrenr Exp $"; 12*2393Syz155240 #endif 13*2393Syz155240 14*2393Syz155240 printproto(pr,p,np)15*2393Syz155240void printproto(pr, p, np) 16*2393Syz155240 struct protoent *pr; 17*2393Syz155240 int p; 18*2393Syz155240 ipnat_t *np; 19*2393Syz155240 { 20*2393Syz155240 if (np != NULL) { 21*2393Syz155240 if ((np->in_flags & IPN_TCPUDP) == IPN_TCPUDP) 22*2393Syz155240 printf("tcp/udp"); 23*2393Syz155240 else if (np->in_flags & IPN_TCP) 24*2393Syz155240 printf("tcp"); 25*2393Syz155240 else if (np->in_flags & IPN_UDP) 26*2393Syz155240 printf("udp"); 27*2393Syz155240 else if (np->in_flags & IPN_ICMPQUERY) 28*2393Syz155240 printf("icmp"); 29*2393Syz155240 #ifdef _AIX51 30*2393Syz155240 /* 31*2393Syz155240 * To make up for "ip = 252" and "hopopt = 0" in /etc/protocols 32*2393Syz155240 */ 33*2393Syz155240 else if (np->in_p == 0) 34*2393Syz155240 printf("ip"); 35*2393Syz155240 #endif 36*2393Syz155240 else if (pr != NULL) 37*2393Syz155240 printf("%s", pr->p_name); 38*2393Syz155240 else 39*2393Syz155240 printf("%d", np->in_p); 40*2393Syz155240 } else { 41*2393Syz155240 #ifdef _AIX51 42*2393Syz155240 if (p == 0) 43*2393Syz155240 printf("ip"); 44*2393Syz155240 else 45*2393Syz155240 #endif 46*2393Syz155240 if (pr != NULL) 47*2393Syz155240 printf("%s", pr->p_name); 48*2393Syz155240 else 49*2393Syz155240 printf("%d", p); 50*2393Syz155240 } 51*2393Syz155240 } 52