SolarCapture C Bindings
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups
Data Structures
SolarCapture Nodes

Data Structures

struct  sc_arista_ts_node
 This node is to be used with Arista switches that are able to add hardware timestamps to packets. This is useful when SolarCapture is doing software timestamping, as it provides more precise timestamps. More...
 
struct  sc_batch_limiter
 Node to limit the maximum batch size sent to downstream nodes. More...
 
struct  sc_delay_line
 Node to delay upstream packets by a random time within a given time range. Randomness is achieved by performing a hash on the destination IP address and can be controlled using the num_lines argument. More...
 
struct  sc_filter
 Node to direct all matched packets to one output and all other packets to another output. The filter can be provided via a BPF string, or via a sc_pkt_predicate object. More...
 
struct  sc_reader
 Takes an input stream of data in PCAP format and outputs individual packets. More...
 
struct  sc_tap
 Forward input to output and a copy of input to the 'tap' output. If a BPF or predicate filter is specified, only packets matching the filter are duplicated to the 'tap' output. More...
 

Detailed Description


Data Structure Documentation

struct sc_arista_ts_node

This node is to be used with Arista switches that are able to add hardware timestamps to packets. This is useful when SolarCapture is doing software timestamping, as it provides more precise timestamps.

Arguments:

Argument Optional? Default Type Description
kf_ip_proto Yes 253 SC_PARAM_INT The IP protocol used to send key frames.
log_level Yes "sync" SC_PARAM_STR The logging level of the node, must be set to one of "silent", "errors", "setup", "sync" or "verbose".
filter_oui Yes SC_PARAM_STR Filter out timestamps with this OUI.
kf_device Yes SC_PARAM_STR Filter keyframes by device field.
kf_eth_dhost No SC_PARAM_STR Destination MAC address for the keyframes.
kf_ip_dest No SC_PARAM_STR Destination IP address for the keyframes.
tick_freq Yes 350000000 SC_PARAM_INT Expected frequency in Hz of the switch tick.
max_freq_error_ppm Yes 20000 SC_PARAM_INT Max ppm between expected and observed frequency before entering no sync state.
lost_sync_ms Yes 10000 SC_PARAM_INT Time after last keyframe to enter lost sync state.
no_sync_ms Yes 60000 SC_PARAM_INT Time after last keyframe to enter no sync state.
no_sync_drop Yes 0 SC_PARAM_INT Toggle sync drop, set to 1 for on 0 for off.
strip_ticks Yes 1 SC_PARAM_INT Toggle the option for the node to strip switch timestamps. Set to 0 for off and 1 for on.

Named Input Links:

None

Output Links:

Link Description
"" All packets that have not been filtered by the node are sent down this link.

Exposed Statistics:

Name Type Data Type Description
max_host_t_delta double config Max delta in seconds the node can compute a tick-delta over.
max_freq_error double config Max ppm allowed between measured and expected tick frequency before entering no sync state.
lost_sync_ms int config Time in milliseconds spent in lost sync state.
no_sync_ms int config Time in milliseconds spent in no sync state.
exp_tick_freq int config The expected tick frequency in Hz.
strip_ticks int config 1 if the node is stripping ticks 0 otherwise.
log_level int config The log level.
tick_freq double magnitude The measured tick frequency in Hz.
n_keyframes uint64_t pkt_count Number of keyframes processed by the node.
n_filtered_oui uint64_t pkt_count Number of packets filtered out by OUI.
n_filtered_other uint64_t pkt_count Number of packets filtered out for other reasons.
n_skew_zero_ticks uint64_t pkt_count Number of skew zero packets received.
n_lost_sync uint64_t pkt_count Number of packets processed whilst in lost sync state.
n_no_sync uint64_t pkt_count Number of packets processed whilst in no sync state.
n_kf_len_mismatch uint64_t pkt_count Number of packets received where the keyframe length did not match.
n_kf_dev_mismatch uint64_t pkt_count Number of packets received where the device field did not match.
n_kf_bad_fcs_type uint64_t pkt_count Number of keyframes with a bad FCS.
kf_switch_drops uint64_t pkt_count Number of keyframes dropped by the switch.
n_kf_big_gap uint64_t pkt_count Number of large gaps between keyframes.
n_skew uint64_t ev_count Number of skews.
enter_no_sync uint64_t ev_count Number of times the node has entered no sync state.
enter_sync1 uint64_t ev_count Number of times the node has entered sync1 state.
enter_sync2 uint64_t ev_count Number of times the node has entered sync2 state.
enter_lost_sync uint64_t ev_count Number of times the node has entered lost sync state.
struct sc_batch_limiter

Node to limit the maximum batch size sent to downstream nodes.

This node can work in one of two modes

  • default – Send packets as soon as possible.
  • on_idle – Only send packets when the node detects it is in an idle state.

Arguments:

Argument Optional? Default Type Description
max_packets Yes 64 SC_PARAM_INT The maximum number of packets in a batch.
mode Yes NULL SC_PARAM_INT Batching mode can be either NULL for default mode or "on_idle".

Named Input Links:

None

Output Links:

Link Description
"" All packets are sent down this link.
struct sc_delay_line

Node to delay upstream packets by a random time within a given time range. Randomness is achieved by performing a hash on the destination IP address and can be controlled using the num_lines argument.

If num_lines = 1:

  • usec/nsec must be a single value.
  • All packets will be delayed by this amount.

If num_lines > 1:

  • usec/nsec must be a range of values <min_delay>-<max_delay>.
  • Non-IP packets are delayed by exactly <min_delay>.
  • IP packets are assigned a line by hashing the destination IP address.
  • For a given line in (0, ..., num_lines-1) the delay is <min_delay> + (<max_delay> - <min_delay>) * (line / num_lines)

Arguments:

Argument Optional? Default Type Description
num_lines Yes 1 SC_PARAM_INT Number of lines used in the hash.
usec Yes NULL SC_PARAM_STR Set this to a string of the form "\<min_delay\>[-\<max_delay\>]" to set the delay time of the node in microseconds.
nsec Yes NULL SC_PARAM_STR Set this to a string of the form "\<min_delay\>[-\<max_delay\>]" to set the delay time of the node in nanoseconds.

Note: One and only one of usec and nsec must be set.

Named Input Links:

None

Output Links:

Link Description
"" All packets are sent down this link.
struct sc_filter

Node to direct all matched packets to one output and all other packets to another output. The filter can be provided via a BPF string, or via a sc_pkt_predicate object.

Arguments:

Argument Optional? Default Type Description
bpf Yes NULL SC_PARAM_STR Filter string in Berkeley Packet Filter format.
predicate Yes NULL SC_PARAM_OBJ An SC_OBJ_PKT_PREDICATE to use as a filter.

Note: Exactly one of bpf and predicate must be set.

Named Input Links:

None

Output Links:

Link Description
"" Packets matched by the filter.
"not_matched" Packets not matched by the filter.
struct sc_reader

Takes an input stream of data in PCAP format and outputs individual packets.

PCAP data can be sent to this node either by passing a filename or file descriptor, in which case the node will create a new ::sc_fd_reader node upstream, or by explicitly connecting a node that sends PCAP data.

Packets can be passed on to downstream nodes in one of three modes:

  • none – Emit packets as they are read.
  • all-input – Emit packets when node receives end-of-stream. There will be a failure at runtime if the pool is too small to hold the entire input file.
  • all-buffers – Emit packets when the buffers are full or when the node receives end-of-stream.

Arguments:

Argument Optional? Default Type Description
prefill Yes "none" SC_PARAM_STR Mode used to read PCAP files, can be one of "none", "all-input" or "all-buffers".
signal_eof Yes 1 SC_PARAM_INT Set to 1 to pass end-of-stream after emitting all packets. Otherwise set to 0
filename Yes NULL SC_PARAM_STR If fd is not set this tells the node to create a ::sc_fd_reader node to read PCAP data from the given filename. If fd is set then this file is used for logging purposes only.
fd Yes -1 SC_PARAM_INT Setting this tells the node to create a ::sc_fd_reader node to read PCAP data from the given file descriptor.

Named Input Links:

None

Output Links:

Link Description
"" The converted unpacked sc_packet stream.
"input" The PCAP format stream.
struct sc_tap

Forward input to output and a copy of input to the 'tap' output. If a BPF or predicate filter is specified, only packets matching the filter are duplicated to the 'tap' output.

The node can be placed in one of two modes:

  • default:
    • Input packets are always forwarded to "" immediately.
    • If buffers are available, they are copied to "tap" immediately, otherwise they never go to tap.
  • Reliable:
    • If buffers are available, all packets are forwarded to "" and "tap" immediately.
    • If not, they are delayed until buffers are available and then forwarded to "" and "tap" at that point.

Note: In reliable mode this node can potentially create a backlog large enough to provoke drops in an upstream node or VI.

Arguments:

Argument Optional? Default Type Description
snap Yes 0 SC_PARAM_INT Copy at most n bytes of the duplicated frames, set to 0 to disable.
reliable Yes 0 SC_PARAM_INT Set to 1/0 to enable/disable reliable mode.
bpf Yes NULL SC_PARAM_STR Filter to select packets to duplicate in BPF format.
predicate Yes NULL SC_PARAM_OBJ Predicate object to select packets to duplicate.

Note: At most one of bpf and predicate may be specified.

Named Input Links:

None

Output Links:

Link Description
"" All packets are sent down this link.
"tap" The copy of the input.