os_pcap.h
Typedefs
-
using ouster::sensor_utils::ts = std::chrono::microseconds
Microsecond timestamp.
Structs
-
struct guessed_ports
Structure representing a hash key/sorting key for a udp stream
-
struct stream_data
Public Members
-
uint64_t count
Number of packets in a specified stream.
-
std::map<uint64_t, uint64_t> payload_size_counts
Packet sizes detected in a specified stream Key: Packet Size Value: Count of a specific packet size
-
std::map<uint64_t, uint64_t> fragment_counts
Fragments detected in a specified stream Key: Number of fragments Value: Count of a specific number of packets
-
std::map<uint64_t, uint64_t> ip_version_counts
IP version detected in a specified stream Key: IP Version Value: Count of the specific ip version
-
uint64_t count
-
struct stream_info
Structure representing the information about network streams in a pcap file
Public Members
-
uint64_t total_packets
The total number of packets detected.
-
uint32_t encapsulation_protocol
The encapsulation protocol for the pcap file
-
std::unordered_map<stream_key, stream_data> udp_streams
Datastructure containing info on all of the different streams
-
uint64_t total_packets
-
struct stream_key
Structure representing a hash key/sorting key for a udp stream
-
struct playback_handle
struct to hide the stepwise playback details.
This struct handles stepwise playback details.
-
struct record_handle
struct to hide the record details.
This struct handles hiding the record details.
-
template<>
struct hash<ouster::sensor_utils::stream_key>
Functions
Warning
doxygenfunction: Unable to resolve function “ouster::sensor_utils::operator<<” with arguments (std::ostream&, const ouster::sensor_utils::packet_info&) in doxygen xml output for project “cpp_api” from directory: /ouster-sdk/docs/_build/latest/doctrees/xml. Potential matches:
- std::ostream &operator<<(std::ostream &stream_in, const packet_info &data)
- std::ostream &operator<<(std::ostream &stream_in, const stream_data &data)
- std::ostream &operator<<(std::ostream &stream_in, const stream_info &data)
- std::ostream &operator<<(std::ostream &stream_in, const stream_key &data)
Warning
doxygenfunction: Unable to resolve function “ouster::sensor_utils::operator<<” with arguments (std::ostream&, const ouster::sensor_utils::stream_key&) in doxygen xml output for project “cpp_api” from directory: /ouster-sdk/docs/_build/latest/doctrees/xml. Potential matches:
- std::ostream &operator<<(std::ostream &stream_in, const packet_info &data)
- std::ostream &operator<<(std::ostream &stream_in, const stream_data &data)
- std::ostream &operator<<(std::ostream &stream_in, const stream_info &data)
- std::ostream &operator<<(std::ostream &stream_in, const stream_key &data)
Warning
doxygenfunction: Unable to resolve function “ouster::sensor_utils::operator<<” with arguments (std::ostream&, const ouster::sensor_utils::stream_data&) in doxygen xml output for project “cpp_api” from directory: /ouster-sdk/docs/_build/latest/doctrees/xml. Potential matches:
- std::ostream &operator<<(std::ostream &stream_in, const packet_info &data)
- std::ostream &operator<<(std::ostream &stream_in, const stream_data &data)
- std::ostream &operator<<(std::ostream &stream_in, const stream_info &data)
- std::ostream &operator<<(std::ostream &stream_in, const stream_key &data)
Warning
doxygenfunction: Unable to resolve function “ouster::sensor_utils::operator<<” with arguments (std::ostream&, const ouster::sensor_utils::stream_info&) in doxygen xml output for project “cpp_api” from directory: /ouster-sdk/docs/_build/latest/doctrees/xml. Potential matches:
- std::ostream &operator<<(std::ostream &stream_in, const packet_info &data)
- std::ostream &operator<<(std::ostream &stream_in, const stream_data &data)
- std::ostream &operator<<(std::ostream &stream_in, const stream_info &data)
- std::ostream &operator<<(std::ostream &stream_in, const stream_key &data)
-
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.
-
std::shared_ptr<record_handle> ouster::sensor_utils::record_initialize(const std::string &file, int frag_size, bool use_sll_encapsulation = false)
Initialize the record handle for recording multi sensor pcap files. Source and destination IPs must be provided with each packet.
- Parameters:
file – [in] The file path to the target pcap to record to.
frag_size – [in] The size of the fragments for packet fragmentation.
use_sll_encapsulation – [in] Whether to use sll encapsulation.
- Returns:
record_handle A handle to the initialized record.
-
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.
-
void ouster::sensor_utils::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)
Record a buffer to a multi sensor record_handle pcap file.
- Parameters:
handle – [in] The record handle that record_initialize has initted.
src_ip – [in] The source address to label the packets with.
dst_ip – [in] The destination address to label the packets with.
src_port – [in] The source port to label the packets with.
dst_port – [in] The destination port to label the packets with.
buf – [in] The buffer to record to the pcap file.
buffer_size – [in] The size of the buffer to record to the pcap file.
microsecond_timestamp – [in] The timestamp to record the packet as microseconds.
Warning
doxygenfunction: Unable to resolve function “ouster::sensor_utils::record_packet” with arguments (record_handle&, const ouster::sensor_utils::packet_info&, const uint8_t*, size_t) in doxygen xml output for project “cpp_api” from directory: /ouster-sdk/docs/_build/latest/doctrees/xml. Potential matches:
- void record_packet(record_handle &handle, const packet_info &info, const uint8_t *buf, size_t buffer_size)
- 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)
-
std::shared_ptr<stream_info> ouster::sensor_utils::get_stream_info(const std::string &file, int packets_to_process = -1)
Return the information about network streams in a pcap file.
- Parameters:
file – [in] The pcap file to read.
packets_to_process – [in] Number of packets to process < 0 for all of them
- Returns:
A pointer to the resulting stream_info
Warning
doxygenfunction: Unable to resolve function “ouster::sensor_utils::get_stream_info” with arguments (const std::string&, std::function<void(uint64_t, uint64_t, uint64_t)>, int, int) in doxygen xml output for project “cpp_api” from directory: /ouster-sdk/docs/_build/latest/doctrees/xml. Potential matches:
- std::shared_ptr<stream_info> get_stream_info(PcapReader &pcap_reader, std::function<void(uint64_t, uint64_t, uint64_t)> progress_callback, int packets_per_callback, int packets_to_process = -1)
- std::shared_ptr<stream_info> get_stream_info(const std::string &file, int packets_to_process = -1)
- std::shared_ptr<stream_info> get_stream_info(const std::string &file, std::function<void(uint64_t current, uint64_t delta, uint64_t total)> progress_callback, int packets_per_callback, int packets_to_process = -1)
-
std::shared_ptr<stream_info> ouster::sensor_utils::get_stream_info(PcapReader &pcap_reader, std::function<void(uint64_t, uint64_t, uint64_t)> progress_callback, int packets_per_callback, int packets_to_process = -1)
Return the information about network streams in a PcapReader and generate indicies (if the PcapReader is an IndexedPcapReader).
- Parameters:
pcap_reader – [in] The PcapReader
progress_callback – [in] A callback to invoke after each packet is scanned current: The current file offset delta: The delta in file offset total: The total size of the file
packets_per_callback – [in] Callback every n packets
packets_to_process – [in] Number of packets to process < 0 for all of them
- Returns:
A pointer to the resulting stream_info
-
std::vector<guessed_ports> ouster::sensor_utils::guess_ports(stream_info &info, int lidar_packet_size, int imu_packet_size, int expected_lidar_port, int expected_imu_port)
Return a guess of the correct ports located in a pcap file.
- Parameters:
info – [in] The stream_info structure generated from a specific pcap file
lidar_packet_size – [in] The size of the lidar packets
imu_packet_size – [in] The size of the imu packets
expected_lidar_port – [in] The expected lidar port from the metadata (pass 0 for unknown)
expected_imu_port – [in] The expected imu port from the metadata (pass 0 for unknown)
- Returns:
A vector (sorted by most likely to least likely) of the guessed ports