! TCP tracing module. Maintain a circular list of the last "few" TCP ! operations as an aid to debugging. %constinteger max TCP trace = 127; ! Suitable for masking %conststring(31) TCP trace name = "INET__TCP_TRACE_BUFFER" %constinteger TCP trace data = 96 %constinteger TCP trace in = 1 %constinteger TCP trace out = 2 %constinteger TCP trace reTX = 3 %constinteger TCP trace check = 4 %constinteger TCP trace ACK = 5 %recordformat TCP trace fm(%integer inout, data bytes, %record(TCB fm) TCB, %record(TCP header fm) TCP header, %bytearray data(1 : TCP trace data)) %constinteger TCP trace size = 4 + 4 + TCB size + %c TCP header size + 4 {options} + TCP trace data %recordformat TCP trace buffer fm(%integer next, %record(TCP trace fm)%array t(0 : max TCP trace)) %ownrecord(TCP trace buffer fm)%name TCP trace buffer == 0 %routine TCP trace(%record(buffer fm)%name b, %integer inout) ! Buffer is sufficient, as we can find everything else of interest from there %record(TCP trace fm)%name t %integer data copy, i %bytename x %if TCP trace buffer == nil %start ! Must initialise TCP trace buffer == %c named heap get(TCP trace size * (max TCP trace + 1) + 4, TCP trace name) !! printstring("Trace buffer initialised at ") !! phex(addr(TCP trace buffer)); newline %finish !! printstring("TCP trace: "); phex(addr(b)); newline t == TCP trace buffer_t(TCP trace buffer_next & max TCP trace) TCP trace buffer_next = TCP trace buffer_next + 1 t_inout = inout %if b_TCB == nil %then t_TCB = 0 %else t_TCB = b_TCB t_TCP header = b_TCP header t_data bytes = b_data bytes data copy = b_data bytes data copy = TCP trace data %if data copy > TCP trace data %if data copy > 0 %start x == b_data start %for i = 1, 1, data copy %cycle t_data(i) = x x == x ++ 1 %repeat %finish %end %end %of %file