*
* @APPLE_LICENSE_HEADER_START@
*
- * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
- *
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
+ * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
+ * Reserved. This file contains Original Code and/or Modifications of
+ * Original Code as defined in and that are subject to the Apple Public
+ * Source License Version 1.0 (the 'License'). You may not use this file
+ * except in compliance with the License. Please obtain a copy of the
+ * License at http://www.apple.com/publicsource and read it before using
+ * this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
+ * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
+ * License for the specific language governing rights and limitations
+ * under the License."
*
* @APPLE_LICENSE_HEADER_END@
*/
static struct timeval lastlog;
static char *savetracename;
+static int iftraceinit();
+
+void
traceinit(ifp)
register struct interface *ifp;
{
- static int iftraceinit();
if (iftraceinit(ifp, &ifp->int_input) &&
iftraceinit(ifp, &ifp->int_output))
fprintf(stderr, "traceinit: can't init %s\n", ifp->int_name);
}
-static
+
+static int
iftraceinit(ifp, ifd)
struct interface *ifp;
register struct ifdebug *ifd;
return (1);
}
+void
traceon(file)
char *file;
{
fprintf(ftrace, "Tracing enabled %s\n", ctime((time_t *)&now.tv_sec));
}
+void
traceoff()
{
if (!traceactions)
* traceactions + tracehistory (packets and contents after change)
* traceactions + tracepackets + tracecontents
*/
+void
bumploglevel()
{
fflush(ftrace);
}
+void
trace(ifd, who, p, len, m)
register struct ifdebug *ifd;
struct sockaddr *who;
t->ift_metric = m;
}
+void
traceaction(fd, action, rt)
FILE *fd;
char *action;
register struct bits *p;
register int first;
char *cp;
- struct interface *ifp;
if (fd == NULL)
return;
traceoff();
}
+void
tracenewmetric(fd, rt, newmetric)
FILE *fd;
struct rt_entry *rt;
traceoff();
}
+void
dumpif(fd, ifp)
FILE *fd;
register struct interface *ifp;
}
}
+void
dumptrace(fd, dir, ifd)
FILE *fd;
char *dir;
t = ifd->ifd_records;
if (t->ift_size == 0)
continue;
- dumppacket(fd, dir, &t->ift_who, t->ift_packet, t->ift_size,
+ dumppacket(fd, dir, (struct sockaddr_in *)&t->ift_who, t->ift_packet, t->ift_size,
&t->ift_stamp);
}
}
+void
dumppacket(fd, dir, who, cp, size, stamp)
FILE *fd;
struct sockaddr_in *who; /* should be sockaddr */
dir, inet_ntoa(who->sin_addr), ntohs(who->sin_port),
ctime((time_t *)&stamp->tv_sec));
else {
- fprintf(fd, "Bad cmd 0x%x %s %x.%d %.19s\n", msg->rip_cmd,
+ fprintf(fd, "Bad cmd 0x%x %s %s.%d\n", msg->rip_cmd,
dir, inet_ntoa(who->sin_addr), ntohs(who->sin_port));
- fprintf(fd, "size=%d cp=%x packet=%x\n", size, cp, packet,
+ fprintf(fd, "size=%d cp=%s packet=%s %.19s\n", size, cp, packet,
ctime((time_t *)&stamp->tv_sec));
fflush(fd);
return;