141edb306SCy Schubert /* 241edb306SCy Schubert * Copyright (C) 2012 by Darren Reed. 341edb306SCy Schubert * 441edb306SCy Schubert * See the IPFILTER.LICENCE file for details on licencing. 541edb306SCy Schubert */ 641edb306SCy Schubert 741edb306SCy Schubert #include "ipf.h" 841edb306SCy Schubert 941edb306SCy Schubert 1041edb306SCy Schubert 1141edb306SCy Schubert 1241edb306SCy Schubert void printproto(struct protoent * pr,int p,ipnat_t * np)13*efeb8bffSCy Schubertprintproto(struct protoent *pr, int p, ipnat_t *np) 1441edb306SCy Schubert { 1541edb306SCy Schubert if (np != NULL) { 1641edb306SCy Schubert if ((np->in_flags & IPN_TCPUDP) == IPN_TCPUDP) 1741edb306SCy Schubert PRINTF("tcp/udp"); 1841edb306SCy Schubert else if (np->in_flags & IPN_TCP) 1941edb306SCy Schubert PRINTF("tcp"); 2041edb306SCy Schubert else if (np->in_flags & IPN_UDP) 2141edb306SCy Schubert PRINTF("udp"); 2241edb306SCy Schubert else if (np->in_flags & IPN_ICMPQUERY) 2341edb306SCy Schubert PRINTF("icmp"); 2441edb306SCy Schubert else if (np->in_pr[0] == 0) 2541edb306SCy Schubert PRINTF("ip"); 2641edb306SCy Schubert else if (pr != NULL) 2741edb306SCy Schubert PRINTF("%s", pr->p_name); 2841edb306SCy Schubert else 2941edb306SCy Schubert PRINTF("%d", np->in_pr[0]); 3041edb306SCy Schubert } else { 3141edb306SCy Schubert if (pr != NULL) 3241edb306SCy Schubert PRINTF("%s", pr->p_name); 3341edb306SCy Schubert else 3441edb306SCy Schubert PRINTF("%d", p); 3541edb306SCy Schubert } 3641edb306SCy Schubert } 37