home *** CD-ROM | disk | FTP | other *** search
- /*
- * prsubs.c
- *
- * Subroutines for printing nettrace records
- *
- */
-
- #include <sys/types.h>
- #include <sys/time.h>
- #include <sys/socket.h>
- #include <netinet/in_systm.h>
- #include <netinet/in.h>
- #include <netinet/ip.h>
- #include <stdio.h>
- #include <errno.h>
- #include <arpa/inet.h>
- #include "ntrace.h"
-
- PrintNetTrace(ntp)
- struct NetTrace *ntp;
- {
- printf("(%d.%06d) ",
- ntp->nt_timestamp.tv_sec,ntp->nt_timestamp.tv_usec);
- switch (ntp->nt_proto) {
- case IPPROTO_TCP:
- printf("TCP ");
- break;
- case IPPROTO_UDP:
- printf("UDP ");
- break;
- default:
- printf("%d ", ntp->nt_proto);
- break;
- }
-
- printf("[%s/%d] -> ",
- inet_ntoa(ntp->nt_srcaddr), ntohs(ntp->nt_srcport));
- printf("[%s/%d]\n",
- inet_ntoa(ntp->nt_dstaddr), ntohs(ntp->nt_dstport));
- }
-