/* trace.c
- Subroutines that support dhcp tracing... */
+ Subroutines that support tracing of OMAPI wire transactions and
+ provide a mechanism for programs using OMAPI to trace their own
+ transactions... */
/*
* Copyright (c) 2001 Internet Software Consortium.
static FILE *traceinfile;
static tracefile_header_t tracefile_header;
static int trace_playback_flag;
+trace_type_t trace_time_marker;
int trace_playback ()
{
}
return ISC_R_UNEXPECTEDTOKEN;
}
+ if (ttp && *ttp == &trace_time_marker)
+ return ISC_R_EXISTS;
paylen = tpkt -> length;
if (paylen % 8)
return status;
}
+time_t trace_snoop_time ()
+{
+ tracepacket_t *tpkt;
+ unsigned bufmax = 0;
+ unsigned buflen = 0;
+ char *buf = (char *)0;
+ isc_result_t status;
+ time_t result;
+ trace_type_t *ttp = &trace_time_marker;
+
+ if (!buf || *buf)
+ return ISC_R_INVALIDARG;
+
+ tpkt = dmalloc ((unsigned)tracefile_header.phlen, MDL);
+ if (!tpkt) {
+ log_error ("can't allocate trace packet header.");
+ return ISC_R_NOMEMORY;
+ }
+
+ trace_get_next_packet (&ttp, tpkt, &buf, &buflen, &bufmax);
+ result = tpkt -> when;
+
+ dfree (tpkt, MDL);
+ return result;
+}
+
/* Get a packet from the trace input file that contains a file with the
specified name. We don't hunt for the packet - it should be the next
packet in the tracefile. If it's not, or something else bad happens,