Output Traces

An output Trace is a trace, indentified by a URI, that a ruby-libtrace progrm can write Packets to.  As with input traces, you must create (OutputTrace.new) and start (OutputTrace.start) an output trace before you can write Packets to it with OutputTrace.write_packet.

Class OutputTrace

Global Constants
compression types See the libtrace documentation for more details
NO_COMPRESSION Write uncompressed trace
ZLIB_COMPRESSION Write using zlib compression
BZIP2_COMPRESSION Write using bzip2 compresion
LZO_COMPRESSION Write using LZO compression

Class Methods
new OutputTrace.new(uri) -> aNewOutputTrace
Returns a libtrace OutputTrace object.  The object's name is given by a string containing its URI, e.g. pcapfile:xxx.bpf,  int:eth0, ...
Throws a LibtraceError exception a new OutputTrace couldn't be created, e.g. because an invalid URI was specified.
conf_snaplen OutputTrace.conf_snaplen(Integer)
Sets snaplen for an OutputTrace; at most the first snaplen bytes of each packet will be recorded for each packet.
Throws a LibtraceError exception if the conf  fails.
conf_compress_type  OutputTrace.conf_compress_type(compression_type)
Sets the compression type that libtrace will use when writing the OutputTrace.
Throws a LibtraceError exception if the conf  fails.
conf_compress_level  OutputTrace.conf_compress_level(Integer)
Sets the compression level that libtrace will use when writing the OutputTrace.  Higher levels give more compression, but lower writing speed.
Levels may be from 1 (minimum) to  9 (maximum),
the default level is 5.
Throws a LibtraceError exception if the conf  fails.
start_output OutputTrace.start_output 
Starts the sending of packets (from a live inteferace), or opens  a trace file for writing.
Throws a LibtraceError exception if the start fails.
close_output OutputTrace.close_output 
Shuts down a live interface, or closes a trace file.
Throws a LibtraceError exception if the close fails.
write_packetOutputTrace.write_packet(Packet)
Writes the data from a Packet to an OutputTrace.
Throws a LibtraceError exception if the write fails.
err? Trace.err? -> true or false
Returns true if a libtrace error has occured for Trace.
get_err Trace.get_err -> anError
Returns a ruby-libtrace Error object, describing Trace's error status.  
Resets Trace's error status to TRACE_NO_ERROR.

Nevil Brownlee
Wed, 1 Jul 11 (NZST)