os_pcap.h

Packet Info

struct ouster::sensor_utils::packet_info

Public Types

using ts = std::chrono::microseconds

Microsecond timestamp.

Public Members

std::string dst_ip

The destination IP.

std::string src_ip

The source IP.

int dst_port

The destination port.

int src_port

The source port.

size_t payload_size

The size of the packet payload.

ts timestamp

The packet capture timestamp.

int fragments_in_packet

Number of fragments in the packet.

int ip_version

The ip version, 4 or 6.

int encapsulation_protocol

PCAP encapsulation type.

int network_protocol

IANA protocol number. Always 17 (UDP)

std::ostream &ouster::sensor_utils::operator<<(std::ostream &stream_in, const packet_info &data)

To string method for packet info structs.

Parameters
  • stream_in[inout] The pre-existing ostream to concat with data.

  • data[in] The packet_info to output.

Returns

The new output stream containing concatted stream_in and data.

Handles

struct record_handle
struct playback_handle

Functions

std::shared_ptr<playback_handle> ouster::sensor_utils::replay_initialize(const std::string &file)

Initialize the stepwise playback handle.

Parameters

file[in] The file path of the pcap file.

Returns

A handle to the initialized playback struct.

void ouster::sensor_utils::replay_uninitialize(playback_handle &handle)

Uninitialize the stepwise playback handle.

Parameters

handle[in] A handle to the initialized playback struct.

void ouster::sensor_utils::replay_reset(playback_handle &handle)

Restart playback from the beginning of the pcap file.

Parameters

handle[in] A handle to the initialized playback struct.

bool ouster::sensor_utils::next_packet_info(playback_handle &handle, packet_info &info)

Return the information on the next packet avaliable in the playback_handle. This must be called BEFORE calling the read_next_packet function.

Parameters
  • handle[in] The playback handle.

  • info[out] The returned information on the next packet.

Returns

The status on whether there is a new packet or not.

size_t ouster::sensor_utils::read_packet(playback_handle &handle, uint8_t *buf, size_t buffer_size)

Read the data from the next packet avaliable in the playback_handle. This must be called AFTER calling the next_packet_info function.

Parameters
  • handle[in] The playback handle.

  • buf[out] The buffer to write the recieved data to (Must be sized appropriately.

  • buffer_size[in] The size of the output buffer.

Returns

0 on no new packet, > 0 the size of the bytes recieved.

Warning

doxygenfunction: Unable to resolve function “ouster::sensor_utils::record_initialize” with arguments None in doxygen xml output for project “cpp_api” from directory: /ouster-sdk/sdk-extensions/docs/standard/multiversions/0.7.1/ouster-sdk/docs/_build/0.7.1/doctrees/xml. Potential matches:

- std::shared_ptr<record_handle> record_initialize(const std::string &file, const std::string &src_ip, const std::string &dst_ip, int frag_size, bool use_sll_encapsulation = false)
- std::shared_ptr<record_handle> record_initialize(const std::string &file, int frag_size, bool use_sll_encapsulation = false)
void ouster::sensor_utils::record_uninitialize(record_handle &handle)

Uninitialize the record handle, closing underlying file.

Parameters

handle[in] An initialized handle for the recording state.

Warning

doxygenfunction: Unable to resolve function “ouster::sensor_utils::record_packet” with arguments (record_handle&, const packet_info&, const uint8_t*, size_t) in doxygen xml output for project “cpp_api” from directory: /ouster-sdk/sdk-extensions/docs/standard/multiversions/0.7.1/ouster-sdk/docs/_build/0.7.1/doctrees/xml. Potential matches:

- void record_packet(record_handle &handle, const std::string &src_ip, const std::string &dst_ip, int src_port, int dst_port, const uint8_t *buf, size_t buffer_size, uint64_t microsecond_timestamp)
- void record_packet(record_handle &handle, int src_port, int dst_port, const uint8_t *buf, size_t buffer_size, uint64_t microsecond_timestamp)