dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / cmd / ipf / lib / common / printaps.c
blob1634b7eea5b6a967ec4c132e9c9c15868313fd56
1 /*
2 * Copyright (C) 1993-2001 by Darren Reed.
4 * See the IPFILTER.LICENCE file for details on licencing.
6 * Added redirect stuff and a variety of bug fixes. (mcn@EnGarde.com)
7 */
9 #include "ipf.h"
10 #include "kmem.h"
13 static const char rcsid[] = "@(#)$Id: printaps.c,v 1.4 2004/01/08 13:34:32 darrenr Exp $";
16 void printaps(aps, opts)
17 ap_session_t *aps;
18 int opts;
20 ipsec_pxy_t ipsec;
21 ap_session_t ap;
22 ftpinfo_t ftp;
23 aproxy_t apr;
24 raudio_t ra;
26 if (kmemcpy((char *)&ap, (long)aps, sizeof(ap)))
27 return;
28 if (kmemcpy((char *)&apr, (long)ap.aps_apr, sizeof(apr)))
29 return;
30 printf("\tproxy %s/%d use %d flags %x\n", apr.apr_label,
31 apr.apr_p, apr.apr_ref, apr.apr_flags);
32 printf("\t\tproto %d flags %#x bytes ", ap.aps_p, ap.aps_flags);
33 #ifdef USE_QUAD_T
34 printf("%qu pkts %qu", (unsigned long long)ap.aps_bytes,
35 (unsigned long long)ap.aps_pkts);
36 #else
37 printf("%lu pkts %lu", ap.aps_bytes, ap.aps_pkts);
38 #endif
39 printf(" data %s size %d\n", ap.aps_data ? "YES" : "NO", ap.aps_psiz);
40 if ((ap.aps_p == IPPROTO_TCP) && (opts & OPT_VERBOSE)) {
41 printf("\t\tstate[%u,%u], sel[%d,%d]\n",
42 ap.aps_state[0], ap.aps_state[1],
43 ap.aps_sel[0], ap.aps_sel[1]);
44 #if (defined(NetBSD) && (NetBSD >= 199905) && (NetBSD < 1991011)) || \
45 (__FreeBSD_version >= 300000) || defined(OpenBSD)
46 printf("\t\tseq: off %hd/%hd min %x/%x\n",
47 ap.aps_seqoff[0], ap.aps_seqoff[1],
48 ap.aps_seqmin[0], ap.aps_seqmin[1]);
49 printf("\t\tack: off %hd/%hd min %x/%x\n",
50 ap.aps_ackoff[0], ap.aps_ackoff[1],
51 ap.aps_ackmin[0], ap.aps_ackmin[1]);
52 #else
53 printf("\t\tseq: off %hd/%hd min %lx/%lx\n",
54 ap.aps_seqoff[0], ap.aps_seqoff[1],
55 ap.aps_seqmin[0], ap.aps_seqmin[1]);
56 printf("\t\tack: off %hd/%hd min %lx/%lx\n",
57 ap.aps_ackoff[0], ap.aps_ackoff[1],
58 ap.aps_ackmin[0], ap.aps_ackmin[1]);
59 #endif
62 if (!strcmp(apr.apr_label, "raudio") && ap.aps_psiz == sizeof(ra)) {
63 if (kmemcpy((char *)&ra, (long)ap.aps_data, sizeof(ra)))
64 return;
65 printf("\tReal Audio Proxy:\n");
66 printf("\t\tSeen PNA: %d\tVersion: %d\tEOS: %d\n",
67 ra.rap_seenpna, ra.rap_version, ra.rap_eos);
68 printf("\t\tMode: %#x\tSBF: %#x\n", ra.rap_mode, ra.rap_sbf);
69 printf("\t\tPorts:pl %hu, pr %hu, sr %hu\n",
70 ra.rap_plport, ra.rap_prport, ra.rap_srport);
71 } else if (!strcmp(apr.apr_label, "ftp") &&
72 (ap.aps_psiz == sizeof(ftp))) {
73 if (kmemcpy((char *)&ftp, (long)ap.aps_data, sizeof(ftp)))
74 return;
75 printf("\tFTP Proxy:\n");
76 printf("\t\tpassok: %d\n", ftp.ftp_passok);
77 ftp.ftp_side[0].ftps_buf[FTP_BUFSZ - 1] = '\0';
78 ftp.ftp_side[1].ftps_buf[FTP_BUFSZ - 1] = '\0';
79 printf("\tClient:\n");
80 printf("\t\tseq %x (ack %x) len %d junk %d cmds %d\n",
81 ftp.ftp_side[0].ftps_seq[0],
82 ftp.ftp_side[0].ftps_seq[1],
83 ftp.ftp_side[0].ftps_len, ftp.ftp_side[0].ftps_junk,
84 ftp.ftp_side[0].ftps_cmds);
85 printf("\t\tbuf [");
86 printbuf(ftp.ftp_side[0].ftps_buf, FTP_BUFSZ, 1);
87 printf("]\n\tServer:\n");
88 printf("\t\tseq %x (ack %x) len %d junk %d cmds %d\n",
89 ftp.ftp_side[1].ftps_seq[0],
90 ftp.ftp_side[1].ftps_seq[1],
91 ftp.ftp_side[1].ftps_len, ftp.ftp_side[1].ftps_junk,
92 ftp.ftp_side[1].ftps_cmds);
93 printf("\t\tbuf [");
94 printbuf(ftp.ftp_side[1].ftps_buf, FTP_BUFSZ, 1);
95 printf("]\n");
96 } else if (!strcmp(apr.apr_label, "ipsec") &&
97 (ap.aps_psiz == sizeof(ipsec))) {
98 if (kmemcpy((char *)&ipsec, (long)ap.aps_data, sizeof(ipsec)))
99 return;
100 printf("\tIPSec Proxy:\n");
101 printf("\t\tICookie %08x%08x RCookie %08x%08x %s\n",
102 (u_int)ntohl(ipsec.ipsc_icookie[0]),
103 (u_int)ntohl(ipsec.ipsc_icookie[1]),
104 (u_int)ntohl(ipsec.ipsc_rcookie[0]),
105 (u_int)ntohl(ipsec.ipsc_rcookie[1]),
106 ipsec.ipsc_rckset ? "(Set)" : "(Not set)");