1 /* 2 * Copyright (C) 2012 by Darren Reed. 3 * 4 * See the IPFILTER.LICENCE file for details on licencing. 5 */ 6 7 #include "ipf.h" 8 9 10 11 12 void 13 printproto(struct protoent *pr, int p, ipnat_t *np) 14 { 15 if (np != NULL) { 16 if ((np->in_flags & IPN_TCPUDP) == IPN_TCPUDP) 17 PRINTF("tcp/udp"); 18 else if (np->in_flags & IPN_TCP) 19 PRINTF("tcp"); 20 else if (np->in_flags & IPN_UDP) 21 PRINTF("udp"); 22 else if (np->in_flags & IPN_ICMPQUERY) 23 PRINTF("icmp"); 24 else if (np->in_pr[0] == 0) 25 PRINTF("ip"); 26 else if (pr != NULL) 27 PRINTF("%s", pr->p_name); 28 else 29 PRINTF("%d", np->in_pr[0]); 30 } else { 31 if (pr != NULL) 32 PRINTF("%s", pr->p_name); 33 else 34 PRINTF("%d", p); 35 } 36 } 37