SolarCapture C Bindings User Guide  SF-115721-CD
Issue 1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
sc_writer Node Reference

Node that writes packets to a file in pcap format.

Detailed Description

The sc_writer node writes incoming packets to a file.

By default O_DIRECT and asynchronous-I/O are used to maximise performance if the underlying filesystem supports those features.

Arguments

Argument Optional? Default Type Description
filename No SC_PARAM_STR Name of file to write to, or filename template when using file rotation
format Yes pcap SC_PARAM_STR File format. One of: pcap (microsecond timestamps) or pcap-ns (nanosecond timestamps).
on_error Yes exit SC_PARAM_STR What to do if an error is generated. One of: exit, abort, message or silent.
append Yes 0 SC_PARAM_INT Set to 1 to append if file exists. (Not compatible with file rotation).
rotate_seconds Yes 0 SC_PARAM_INT Rotate to a new file every n seconds.
rotate_file_size Yes 0 SC_PARAM_INT Rotate to a new file when file exceeds given size in bytes.
snap Yes 0 SC_PARAM_INT Maximum number of bytes of packet data to store. By default whole packets are stored.
sync_on_close Yes 0 SC_PARAM_INT Set to 1 to cause an fsync() when a file is closed.

Named Input Links

Input links may be named, in which case the packets are forwarded to a matching named output link.

Output Links

Link Description
"" Packets from all inputs are forwarded to this link.
"#packed" Buffers containing the on-disk format are forwarded to this link (if they are generated).
NAME If NAME matches the name of an input link, then input packets are forwarded to the corresponding output link.

Exposed Statistics

Statistics exposed by the sc_writer node.

Name Type Data Type Description
cap_bytes uint64_t byte_count Sum of payload bytes.
link_bytes uint64_t byte_count Sum of frame_len (bytes on wire before snapping).
write_bytes uint64_t byte_count Sum of bytes written to disk.